Skip to content

Instantly share code, notes, and snippets.

@Magnus167
Last active December 29, 2024 03:19
Show Gist options
  • Save Magnus167/7dcdc8ad007aabf577a5d1c14b78e90d to your computer and use it in GitHub Desktop.
Save Magnus167/7dcdc8ad007aabf577a5d1c14b78e90d to your computer and use it in GitHub Desktop.
Chrome history export for analytics
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