脚本宝典收集整理的这篇文章主要介绍了读取谷歌浏览器history 文件,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Chrome上网记录提取小试——History - 知乎 (zhihu.com)
.这个文件是sqllite格式
python 读取sqllite
1 # -*- coding:utf8 -*- 2 3 ''' 4 Author:Wang Yanlong 5 Date: 2017-08-16 6 7 All rights reserved. 8 Distributed under the BSD license. 9 10 References: 11 https://docs.python.org/2/library/sqlite3.html (English) 12 http://www.runoob.com/sqlite/sqlite-python.html (Chinese) 13 ''' 14 15 import sqlite3 as db 16 17 # 从SQLite文件中读取数据 18 def readFronSqllite(db_path,exectCmd): 19 conn = db.connect(db_path) # 该 API 打开一个到 SQLite 数据库文件 database 的链接,如果数据库成功打开,则返回一个连接对象 20 cursor=conn.cursor() # 该例程创建一个 cursor,将在 Python 数据库编程中用到。 21 conn.row_factory=db.Row # 可访问列信息 22 cursor.execute(exectCmd) #该例程执行一个 SQL 语句 23 rows=cursor.fetchall() #该例程获取查询结果集中所有(剩余)的行,返回一个列表。当没有可用的行时,则返回一个空的列表。 24 return rows 25 #print(rows[0][2]) # 选择某一列数据 26 27 # 解析ARPA 单帧信息 28 def readfromAppaFrame(ARPAFrame): 29 subARPA=ARPAFrame.split(',') 30 print(subARPA) 31 32 if __name__=="__main__": 33 rows=readFronSqllite('E://ARPA.db',"select ARPA from ARPAInfo") 34 readLines=10010 35 lineIndex=10000 36 while lineIndex<readLines: 37 row=rows[lineIndex] # 获取某一行的数据,类型是tuple 38 content="".join(row) #tuple转字符串 39 readfromAppaFrame(content) # 解析ARPA数据 40 lineIndex+=1
以上是脚本宝典为你收集整理的读取谷歌浏览器history 文件全部内容,希望文章能够帮你解决读取谷歌浏览器history 文件所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。