google.takeout.paths: return Optional if there are no takeouts
This commit is contained in:
parent
4666378f7e
commit
e8e4994c02
6 changed files with 30 additions and 19 deletions
|
@ -21,6 +21,9 @@ def watched() -> Iterable[Watched]:
|
|||
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
|
||||
last = get_last_takeout(path=path)
|
||||
if last is None:
|
||||
return []
|
||||
|
||||
|
||||
watches: List[Watched] = []
|
||||
for dt, url, title in read_html(last, path):
|
||||
|
@ -30,14 +33,11 @@ def watched() -> Iterable[Watched]:
|
|||
return list(sorted(watches, key=lambda e: e.when))
|
||||
|
||||
|
||||
from ..core import stat, Stats
|
||||
def stats() -> Stats:
|
||||
return stat(watched)
|
||||
|
||||
|
||||
# todo deprecate
|
||||
get_watched = watched
|
||||
|
||||
|
||||
def main():
|
||||
# TODO shit. a LOT of watches...
|
||||
for w in get_watched():
|
||||
print(w)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue