Skip to content

Instantly share code, notes, and snippets.

@sug0
Last active March 16, 2020 20:22
Show Gist options
  • Select an option

  • Save sug0/e68fba40be8e9a5b8ee3ee3aed2c7852 to your computer and use it in GitHub Desktop.

Select an option

Save sug0/e68fba40be8e9a5b8ee3ee3aed2c7852 to your computer and use it in GitHub Desktop.
How I lost my mind looking for a techno song
# Let us write some code to snoop up our firefox history database file...
# This is when hoarding browser history links is actually useful!
# Never nuke your browser history, kids! :^)
import re
import sqlite3
from contextlib import closing
from sys import argv
if __name__ == '__main__':
r = re.compile(r'[gG][^-]+-[^-]+- YouTube')
with sqlite3.connect(argv[1]) as conn:
with closing(conn.cursor()) as c:
c.execute('''
select title, url from moz_places
inner join moz_historyvisits
on moz_historyvisits.place_id = moz_places.id
where url like "%youtube.com%"
''')
for (title, url) in c:
if title and r.match(title):
# turns out it's this:
# https://www.youtube.com/watch?v=zdoyapuXM_s
print(f'{title} : {url}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment