user234683 / youtube-local

browser-based client for watching Youtube anonymously and with greater page performance
GNU Affero General Public License v3.0
486 stars 62 forks source link

Video pages for a channel don't work #180

Closed MBCX closed 9 months ago

MBCX commented 11 months ago

Going to any channel seems to load the first page of videos fine. Trying to go to any other page returns the following 500:

Traceback (most recent call last):
  File "E:\Repos\youtube-local\env\lib\site-packages\flask\app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "E:\Repos\youtube-local\env\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "E:\Repos\youtube-local\env\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "E:\Repos\youtube-local\env\lib\site-packages\flask\app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "E:\Repos\youtube-local\youtube\channel.py", line 464, in get_channel_page
    return get_channel_page_general_url('https://www.youtube.com/channel/' + channel_id, tab, request, channel_id)
  File "E:\Repos\youtube-local\youtube\channel.py", line 380, in get_channel_page_general_url
    util.check_gevent_exceptions(*tasks)
  File "E:\Repos\youtube-local\youtube\util.py", line 602, in check_gevent_exceptions
    raise task.exception
  File "src\\gevent\\greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
  File "E:\Repos\youtube-local\youtube\channel.py", line 234, in get_channel_tab
    content = util.fetch_url(
  File "E:\Repos\youtube-local\youtube\util.py", line 359, in fetch_url
    raise FetchError(str(response.status), reason=response.reason,
youtube.util.FetchError: HTTP error during request: 500 Internal Server Error

Also, the Shorts, Streams, and Playlists pages seem to not work as well, returning no videos. Also, I tried doing the same with and without tor, still getting this issue.

MBCX commented 11 months ago

I previously mention something like this before here #178. But that was temporary (for whatever reason), but now it seems to be consistent.

metrast commented 10 months ago

I have the same issue on macOS:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Applications/youtube-local-2.8.4/youtube/channel.py", line 464, in get_channel_page
    return get_channel_page_general_url('https://www.youtube.com/channel/' + channel_id, tab, request, channel_id)
  File "/Applications/youtube-local-2.8.4/youtube/channel.py", line 380, in get_channel_page_general_url
    util.check_gevent_exceptions(*tasks)
  File "/Applications/youtube-local-2.8.4/youtube/util.py", line 602, in check_gevent_exceptions
    raise task.exception
  File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
  File "/Applications/youtube-local-2.8.4/youtube/channel.py", line 234, in get_channel_tab
    content = util.fetch_url(
  File "/Applications/youtube-local-2.8.4/youtube/util.py", line 359, in fetch_url
    raise FetchError(str(response.status), reason=response.reason,
youtube.util.FetchError: HTTP error during request: 500 Internal Server Error
user234683 commented 10 months ago

I think the best approach is to give up on using the browse API for channels since YouTube breaks it so often, and switch to the Uploads From playlist. All channel ids start with UC. If you replace this with UU, it is becomes the id for a playlist with all the user's uploads (youtube-local gets the channel video count from this playlist already). So you get easy pagination using an API that's already well known and that YouTube hasn't changed since the first time I implemented it.

This would also alleviate the need to maintain separate Shorts and Streams tabs since the playlist includes everything - the latest playlist page from YouTube even provides a way to filter out shorts but not streams.

The only thing that would be missing is sorting by views

2200g commented 10 months ago

same issue on linux, (this is youtube-local, i just renamed it yt-local)

Traceback (most recent call last):
  File "/home/aadi/.local/src/yt-local/env/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aadi/.local/src/yt-local/env/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aadi/.local/src/yt-local/env/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aadi/.local/src/yt-local/env/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aadi/.local/src/yt-local/youtube/channel.py", line 464, in get_channel_page
    return get_channel_page_general_url('https://www.youtube.com/channel/' + channel_id, tab, request, channel_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aadi/.local/src/yt-local/youtube/channel.py", line 380, in get_channel_page_general_url
    util.check_gevent_exceptions(*tasks)
  File "/home/aadi/.local/src/yt-local/youtube/util.py", line 602, in check_gevent_exceptions
    raise task.exception
  File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
  File "/home/aadi/.local/src/yt-local/youtube/channel.py", line 234, in get_channel_tab
    content = util.fetch_url(
              ^^^^^^^^^^^^^^^
  File "/home/aadi/.local/src/yt-local/youtube/util.py", line 359, in fetch_url
    raise FetchError(str(response.status), reason=response.reason,
youtube.util.FetchError: HTTP error during request: 500 Internal Server Error