Skip to content

Commit

Permalink
sources.takeout: use reconstruct_comment_content directly to workarou…
Browse files Browse the repository at this point in the history
…nd weird formatted json data in takeout

see purarue/google_takeout_parser#79
  • Loading branch information
karlicoss committed Sep 29, 2024
1 parent 81c5945 commit b08db7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/promnesia/sources/filetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def ignore(*_args, **_kwargs):
'font/woff': ignore,
'text/x-Algol68': ignore, # ugh some license file had this?? maybe always index text/ as text?
'text/x-bytecode.python': ignore, # todo ignore all x-bytecode?
'text/calendar': ignore,

# TODO not sure what to do about these..
'application/octet-stream': handle_later,
Expand Down
5 changes: 2 additions & 3 deletions src/promnesia/sources/takeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from __future__ import annotations

import json
import warnings
from typing import Any, Iterable, NamedTuple

Expand Down Expand Up @@ -142,7 +141,7 @@ def warn_once_if_not_seen(e: Any) -> Iterable[Exception]:
url=url, dt=e.dt, context=e.content, locator=Loc(title=e.content, href=url)
)
elif imported_yt_csv_models and isinstance(e, CSVYoutubeComment):
contentJSON = json.loads(e.contentJSON)
contentJSON = e.contentJSON
content = reconstruct_comment_content(contentJSON, format='text')
if isinstance(content, Exception):
yield content
Expand All @@ -160,7 +159,7 @@ def warn_once_if_not_seen(e: Any) -> Iterable[Exception]:
url=e.video_url, dt=e.dt, context=content, locator=Loc(title=context, href=e.video_url)
)
elif imported_yt_csv_models and isinstance(e, CSVYoutubeLiveChat):
contentJSON = json.loads(e.contentJSON)
contentJSON = e.contentJSON
content = reconstruct_comment_content(contentJSON, format='text')
if isinstance(content, Exception):
yield content
Expand Down

0 comments on commit b08db7c

Please sign in to comment.