Last active
December 29, 2024 03:19
-
-
Save Magnus167/7dcdc8ad007aabf577a5d1c14b78e90d to your computer and use it in GitHub Desktop.
Chrome history export for analytics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
import pandas as pd | |
USERNAME = "your_username" | |
# Path to the Chrome history file | |
history_db = fr"C:\Users\{USERNAME}\AppData\Local\Google\Chrome\User Data\Default\History" | |
# Connect to SQLite database | |
conn = sqlite3.connect(history_db) | |
# Query the URLs table | |
query = "SELECT url, title, visit_count, last_visit_time FROM urls" | |
df = pd.read_sql_query(query, conn) | |
# Save to CSV | |
df.to_csv("chrome_history.csv", index=False) | |
conn.close() | |
print("Chrome history exported to 'chrome_history.csv'.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment