0、flomo导出html格式-转为txt、excel格式,删除一些长笔记保证在AI输入范围内-丢给AI-提问
1、flomo会员、导出全部笔记为html格式
2、使用python程序转为txt、excel
from bs4 import BeautifulSoup
def html_file_to_text_with_newlines(file_path):
# 读取本地 HTML 文件
with open(file_path, 'r', encoding='utf-8') as file:
html = file.read()
# 使用 BeautifulSoup 解析 HTML
soup = BeautifulSoup(html, 'html.parser')
# 提取并保留换行的文本
lines = []
for string in soup.stripped_strings:
lines.append(string)
text_with_newlines = '\n'.join(lines)
# 返回处理过的文本
return text_with_newlines
# 指定本地 HTML 文件的路径
# file_path = r'C:\Users\Administrator\Desktop\flomo@块头-20231221\index.html' # 根据您的文件位置进行修改
file_path = r'C:\Users\Administrator\Desktop\flomo@块头-20240201\块头的笔记.html' # 根据您的文件位置进行修改
# 调用函数并获取文本
text = html_file_to_text_with_newlines(file_path)
# 将结果保存到 .txt 文件
with open('flomo@块头-20240201.txt', 'w', encoding='utf-8') as file:
file.write(text)
print("HTML 文件的内容已转换为纯文本并保存到 output.txt")
import pandas as pd
import re
def 提取笔记(文件路径):
# 读取文本文件
with open(文件路径, 'r', encoding='utf-8') as 文件:
内容 = 文件.read()
# 使用正则表达式匹配日期、时间和内容
# 匹配模式 = r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\n(.*?)\n\n'
匹配模式 = r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})(.*?)(?=\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}|\Z)'
匹配结果 = re.findall(匹配模式, 内容, re.DOTALL)
# 创建 DataFrame
数据框 = pd.DataFrame(匹配结果, columns=['日期时间', '内容'])
# 处理日期和时间
数据框['日期时间'] = pd.to_datetime(数据框['日期时间'])
return 数据框
# 指定文件路径
# 文件路径 = 'flomo@块头-20240201.txt' # 替换为您的文件路径
文件路径 = r'C:\Users\Administrator\Desktop\flomo@块头-20231125\flomo@块头-20240201.txt' # 替换为您的文件路径
# 提取笔记
笔记数据框 = 提取笔记(文件路径)
# 保存到 Excel 文件
Excel路径 = '20240201.xlsx'
笔记数据框.to_excel(Excel路径, index=False)
print(f"笔记已保存到 {Excel路径}")
3、excel本字符串的长度=LEN(text)
使用excel函数,给每一个笔记计算一下字数,倒序,文字太长的删除一些,满足AI上传txt的长度限制。
实测,12万字
4、上传到GPT4、月之暗面
https://kimi.moonshot.cn/
5、提问吧
6、
7、内容总结还行,一次性出时间是乱编的,单独问是对的
7、
8、提问过多需要重新开?
9、帐号密码如果保存在笔记中,也能搜索出来哦。。。
10、外脑,如何去定义他
貌似一个人,认真的读了我的每一个笔记。。
兴奋被看到、又恐惧看得这么清晰?
11、确实是我说的,不信你们搜索我的公众号,应该发表过