You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifically, I believe that yt-formatted-string is no longer populated, breaking everything from "likes" and below.
I expect to see something similar to this as noted here
$ python extract_video_info.py https://www.youtube.com/watch?v=jNQXAC9IVRwTitle: Me at the zooViews: 172639597Published at: 2005-04-23Video Duration: 0:18Video tags: me at the zoo, jawed karim, first youtube videoLikes: 8188077Dislikes: 191986Description: The first video on YouTube. While you wait for Part 2, listen to this great song: https://www.youtube.com/watch?v=zj82_v2R6tsChannel Name: jawedChannel URL: https://www.youtube.com/channel/UC4QobU6STFB0P71PMvOGN5AChannel Subscribers: 1.98M subscribers
But I instead get this :(
mattpopovich@MBP $ python3 extract_video_info.py 'https://www.youtube.com/watch?v=jNQXAC9IVRw'Traceback (most recent call last): File "/Users/mattpopovich/Documents/extract_video_info.py", line 58, in <module> data = get_video_info(url) File "/Users/mattpopovich/Documents/extract_video_info.py", line 32, in get_video_info result["likes"] = ''.join([ c for c in text_yt_formatted_strings[0].attrs.get("aria-label") if c.isdigit() ])IndexError: list index out of range
I'm looking into it... Just wanted to document it now for the time being.
Looks like the ytInitialData variable has a "defaultText":{"accessibility":{"accessibilityData":{"label":"##### likes"}} which might be promising
Activity
mattpopovich commentedon Jan 4, 2022
A temporary fix/hack for likes:
Not sure if there's anything we can do to get dislikes anymore... Hopefully there's an easier way to get likes.
I can make a PR if you'd like, just let me know.
x4nth055 commentedon Jan 8, 2022
Thanks, @mattpopovich. I mentioned your contribution in the tutorial! Check it out: https://www.thepythoncode.com/article/get-youtube-data-python
mattpopovich commentedon Jan 10, 2022
Appreciate the shoutout, @x4nth055!