import sqlite3, shutil, os

history_path = os.path.expandvars(r"%LOCALAPPDATA%\Google\Chrome\User Data\Default\History")
temp_path = os.path.expandvars(r"%LOCALAPPDATA%\Google\Chrome\User Data\Default\History_temp")

if os.path.exists(history_path):
    shutil.copy2(history_path, temp_path)
    conn = sqlite3.connect(temp_path)
    cur = conn.cursor()
    cur.execute("SELECT url, title, last_visit_time FROM urls WHERE url LIKE '%ysenra%' OR url LIKE '%shopify%' OR url LIKE '%8000%' OR url LIKE '%8088%' ORDER BY last_visit_time DESC LIMIT 20")
    for row in cur.fetchall():
        print(f"{row[0][:90]} | {row[1][:40]}")
    conn.close()
    try:
        os.remove(temp_path)
    except:
        pass
else:
    print("History not found at", history_path)
