Home > Enterprise >  Python - reading History file of chrome
Python - reading History file of chrome

Time:03-27

I try using the following code to read chrome history file

import sqlite3
con = sqlite3.connect(r'C:\Users\User\AppData\Local\Google\Chrome\User Data\Default\History')
cursor = con.cursor()
cursor.execute("SELECT url FROM urls")
urls = cursor.fetchall()
print('\n'.join(urls))

if I run the code I get Process finished with exit code 0 I tried it with chinook.db every website , guide , tutorial shows the same way with tweaks added nothing worked . tried using python3.10 & python3.9

I use windows10 , created VM with win10 and it works there any suggestions?

I placed history file in another folder and chrome still has its history , rechecked user , path seems chrome takes his history from some another place

i used chinook.db and it worked , obviously chrome history file isn't empty but nothing prints

opened history.db using DB browser and it seems to be empty , but chrome shows otherwise

I have deleted History file from chrome now i get the following error ( visited few sites to make sure it's not empty )

    cursor.execute("SELECT url FROM urls")
sqlite3.OperationalError: no such table: urls

CodePudding user response:

Finally solved the issue , I deleted C:\Users{User}\AppData\Local\Google\Chrome folder then relaunched chrome , and everything works.

  • Related