Skip to content

Fetching videos of channel fails due to cookie accept pop-up #1

@iAmInActions

Description

@iAmInActions

Attempting to fetch the videos of a channel fails as youtube redirects to the "accept cookies" page from which it would usually return to the previous, but the script doesnt know how to accept the cookies:

Traceback (most recent call last):
  File "/mnt/mmcblk1p1/Projects/MinkVidious2/yt-meta-testing.py", line 24, in <module>
    for video in itertools.islice(videos_generator, 10):
                 ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/minki/.local/lib/python3.13/site-packages/yt_meta/fetchers.py", line 452, in get_channel_videos
    yield from self._process_videos_generator(
    ...<6 lines>...
    )
  File "/home/minki/.local/lib/python3.13/site-packages/yt_meta/fetchers.py", line 44, in _process_videos_generator
    for video in video_generator:
                 ^^^^^^^^^^^^^^^
  File "/home/minki/.local/lib/python3.13/site-packages/yt_meta/fetchers.py", line 287, in _get_raw_channel_videos_generator
    initial_data, ytcfg, _ = self._get_channel_page_data(
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        channel_url, force_refresh=force_refresh
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/minki/.local/lib/python3.13/site-packages/yt_meta/fetchers.py", line 183, in _get_channel_page_data
    response.raise_for_status()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/minki/.local/lib/python3.13/site-packages/httpx/_models.py", line 829, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Redirect response '302 Found' for url 'https://www.youtube.com/@minkispacebirb/videos'
Redirect location: 'https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2F%40minkispacebirb%2Fvideos%3Fcbrd%3D1&gl=DE&m=0&pc=yt&cm=2&hl=en&src=1'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302

A possible solution would be to adjust yt_meta/fetchers.py to detect this pop-up and accept it, then store and recall the token in the YtMeta object for the current session.

I will attempt to add this functionality once i have enough time to do so and will probably open a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions