Created
July 24, 2024 09:40
-
-
Save mtimkovich/a9a350a859010698996dbc663d663e25 to your computer and use it in GitHub Desktop.
Netflix watched history to Letterboxd
This file contains 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 csv | |
from datetime import datetime | |
import re | |
def is_tv(title: str) -> bool: | |
synonyms = '(Season|Part|Volume|Chapter|Series|Book|Collection)' | |
text_numbers = '(One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten)' | |
return (re.search(f'{synonyms} (\\d+|{text_numbers})', title) | |
or 'Limited Series' in title) | |
if __name__ == '__main__': | |
input = open('NetflixViewingHistory.csv') | |
output = open('netflix_letterboxd.csv', 'w') | |
reader = csv.reader(input) | |
writer = csv.writer(output) | |
writer.writerow(['Title', 'WatchedDate']) | |
for i, row in enumerate(reader): | |
if i == 0: | |
continue | |
title = row[0] | |
# Attempt to cull TV shows. | |
if is_tv(title): | |
continue | |
watched_date = datetime.strptime(row[1], '%m/%d/%y') | |
watched_date = watched_date.strftime('%Y-%m-%d') | |
writer.writerow([title, watched_date]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment