google chrome 获取书签的添加日期

有的时候想找一个书签的添加日期, 在浏览器上貌似看不到

 

设备: win10

google 书签位置:

username 是你的用户名

C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\Bookmarks

 python 获取数据

import pandas as pd
import json
import datetime

with open(r'C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\Bookmarks', mode='r', encoding='utf-8') as f:
    jo = f.read()
    

joo = json.loads(jo)

jo_df = pd.json_normalize(data=joo, record_path=['roots','other','children','children'])

# 17位时间戳转日期
# 参考 https://zhuanlan.zhihu.com/p/676444806
date1 = datetime.datetime.strptime('1970-01-01 00:00:00', '%Y-%m-%d %H:%M:%S')
date2 = datetime.datetime.strptime('1601-01-01 00:00:00', '%Y-%m-%d %H:%M:%S')
jo_df['create_date'] = jo_df['date_added'].apply(lambda x: datetime.datetime.fromtimestamp(int(x)/1000000-(date1-date2).days*24*60*60))

 



 

posted @ 2024-02-18 22:28  dontbealarmedimwithy  阅读(218)  评论(0编辑  收藏  举报