github: start moving to a proper artbitrated module

This commit is contained in:
Dima Gerasimov 2020-06-01 22:10:29 +01:00
parent 67cf4d0c04
commit d7aff1be3f
5 changed files with 27 additions and 13 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
from datetime import datetime
from typing import NamedTuple, List
from typing import NamedTuple, List, Iterable
from ..google.takeout.html import read_html
from ..google.takeout.paths import get_last_takeout
@ -16,7 +16,7 @@ class Watched(NamedTuple):
return f'{self.url}-{self.when.isoformat()}'
def get_watched():
def watched() -> Iterable[Watched]:
# TODO need to use a glob? to make up for old takouts that didn't start with Takeout/
path = 'Takeout/My Activity/YouTube/MyActivity.html' # looks like this one doesn't have retention? so enough to use the last
# TODO YouTube/history/watch-history.html, also YouTube/history/watch-history.json
@ -30,6 +30,10 @@ def get_watched():
return list(sorted(watches, key=lambda e: e.when))
# todo deprecate
get_watched = watched
def main():
# TODO shit. a LOT of watches...
for w in get_watched():