写了一个小东西,用来看自己前段时间(其实是所有时间),在edge游览器上存储的访问数据。使用的数据来自edge的WebAssistDatabase, 但是原来的default目录下其实还有history等文件,这里没有考虑。
实现效果如下:
使用本地的数据,路径使用os的模块获得, 数据在c盘,复制并且粘贴到当前文件夹。
default_path = os.path.expanduser("~") + r'\AppData\Local\Microsoft\Edge\User Data\Default\WebAssistDatabase'
def get_data():
if 'Web_data.db' not in os.listdir():
default_path = os.path.expanduser("~") + r'\AppData\Local\Microsoft\Edge\User Data\Default\WebAssistDatabase'
shutil.copy(default_path, './Web_data.db') # 修改文件名防止错混
print(f'copy and rename the data file in {
default_path}.')
else:
print('Web_data.db already exists.')
return 'Web_data.db' # 返回数据库名
输入提示 ‘all’, 返回所有的数据, 数据量大的话很难看;普通的数字(一定是正整数),则返回相应数目的数据;直接回车,什么都不输入,默认50条数据;
输入’q’, 退出。
the number of most visited webs you want,
"all" for all (better not), default is 50 (suggested), "q" for quit>>>
源代码如下:
# -*- coding : utf-8 -*-
# @Author : belli dura despicio
# @Time : 2022/8/2 16:01
# @File : analyse_data.py
# @software : PyCharm
# 针对EDGE的数据,制作不同页面访问次数的