xenova / chat-downloader

A simple tool used to retrieve chat messages from livestreams, videos, clips and past broadcasts. No authentication needed!
https://chat-downloader.readthedocs.io/
MIT License
948 stars 132 forks source link

[BUG] Youtube get_user_videos error #174

Closed ArthurKun21 closed 1 year ago

ArthurKun21 commented 2 years ago

Basic information

Describe the bug

User cannot be found while doing the youtube get_user_videos

Command/Code used

Otherwise, if using the python module, provide the following:

  1. A minimal reproducible example:
    
    from chat_downloader.sites import YouTubeChatDownloader

channel_id = "UC_vMYWcDjmfdpH6r4TTn1MQ"

youtube = YouTubeChatDownloader() video_ids = youtube.get_user_videos( channel_id=channel_id, )

for video_id in video_ids: print(f"{video_id}")

2. Output, traceback or other information relating to the bug:

chat_downloader.errors.UserNotFound: Unable to find user: "https://www.youtube.com/channel/UC_vMYWcDjmfdpH6r4TTn1MQ"



## Expected behavior
Will be able to get the user videos

## Additional context/information
I think this might be due to the youtube updating their platform and adding the handles. Might worth looking into it
devmaxxing commented 1 year ago

I'm encountering this issue too. It's probably due to Youtube's recent UI changes. A workaround for this is to extract the videoid from the youtube channel /live link

For example with curl and grep:

videoId=$(curl -s https://www.youtube.com/c/"$channelid"/live| grep -o -E '\{"videoId":"[a-z0-9A-Z_-]{11}' | head -1)
videoId=${videoId:12:11}
xenova commented 1 year ago

Yes it it is because of YouTube UI's changes. Other libraries, like pytube, also have the same problem currently. Fortunately, there are some PRs with fixes, like https://github.com/pytube/pytube/pull/1409

Would one of you like to make those changes here and submit a PR?

devmaxxing commented 1 year ago

What about adding support for /live urls and then just use that to get the livestream for when a channel url is entered instead of parsing the channel page?