Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

my.media.youtube returning [] #113

Closed
mdroidian opened this issue Dec 7, 2020 · 4 comments · Fixed by #235
Closed

my.media.youtube returning [] #113

mdroidian opened this issue Dec 7, 2020 · 4 comments · Fixed by #235
Labels
bug Something isn't working takeout

Comments

@mdroidian
Copy link

So I've set up HPI on Windows WSL2 Ubuntu 20.04.
But for the life of me I can't seem to get my.media.youtube to work

python3 -c 'import my.media.youtube as yt; print(yt.watched())'
Just returns []

Also:
python3 -c 'import my.media.youtube as yt; print(yt.stats())'
{'watched': {'count': 0, 'warning': 'THE ITERABLE RETURNED NO DATA'}}

python3 -c 'import my.google.takeout.paths as tk; print(tk.get_last_takeout())' does return the takeout zip file.
And that file does have \Takeout\My Activity\YouTube\My Activity.html

hpi doctor my.google.takeout.paths
Comes back all green

but
hpi modules --all lists [disabled: marked explicitly (via __NOT_HPI_MODULE__)] for my.google.takeout.paths

I'm not sure where to go from here!
Any ideas what I could try next? 😎

@karlicoss
Copy link
Owner

karlicoss commented Dec 7, 2020

Thanks for the details!

python3 -c 'import my.media.youtube as yt; print(yt.stats())

just fyi, this would be the same as hpi doctor my.media.youtube

[disabled: marked explicitly (via __NOT_HPI_MODULE__)

yeah, that's expected, since my.google.takeout.paths is an auxiliary module, not a 'user-facing' one'

Regarding the actual problem: hmm. My hunch would be that maybe there is some issue with the path within the zip archive on Windows? i.e this bit

HPI/my/media/youtube.py

Lines 21 to 25 in 8abe665

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 []
Although judging by Zipfile code it just always uses forward slashes internally, so should be portable.. https://github.com/python/cpython/blob/a4e7d5f750e06e31a80a83c2af02b1a40cecd0ff/Lib/zipfile.py#L355-L356

Can you put a breakpoint there, or a print(last) statement on to see if it actually finds the file there?
Or maybe just python3 -c "import my.google.takeout.paths as P; print(P.get_last_takeout(path='Takeout/My Activity/YouTube/MyActivity.html'))" should work too

@mdroidian
Copy link
Author

Yup, those returned None
But I figured it out! The filepath in my takeout the file is My Activity.html but in ln21 of youtube.py it's MyActivity.html

Bleh, can't believe I missed that! 🙈

@karlicoss
Copy link
Owner

oh wow.. I checked mine and it's definitely MyActivity.html. Damnit :)
I guess the easiest 'proper' fix would be to add another get_last_takeout call under that if condition, with My Activity.html to give it a chance to find a different file.
Somewhat related to karlicoss/kompress#10, if there was a nice uniform interface, would be possible to use something like glob('*Activity.html')...

@karlicoss karlicoss added the bug Something isn't working label Feb 15, 2021
@karlicoss
Copy link
Owner

karlicoss added a commit that referenced this issue Apr 20, 2022
- fallback on the old logic if google_takeout_parser isn't available
- move to my.youtube.takeout (possibly mixing in other sources later)
- keep my.media.youtube, but issue deprecation warning
  currently used in orger etc, so doesn't hurt to keep
- also fixes #113
karlicoss added a commit that referenced this issue Apr 20, 2022
- fallback on the old logic if google_takeout_parser isn't available
- move to my.youtube.takeout (possibly mixing in other sources later)
- keep my.media.youtube, but issue deprecation warning
  currently used in orger etc, so doesn't hurt to keep
- also fixes #113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working takeout
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants