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

[ie/olympics] Fix extraction #10625

Merged
merged 4 commits into from
Aug 1, 2024
Merged

Conversation

bashonly
Copy link
Member

@bashonly bashonly commented Aug 1, 2024

Bugfix for 2f1ddfe

Closes #10592

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense

What is the purpose of your pull request?

  • Fix or improvement to an extractor (Make sure to add/update tests)

Authored by: bashonly
@bashonly bashonly added site-bug Issue with a specific website needs-testing Patch needs testing labels Aug 1, 2024
Authored by: bashonly
Authored by: bashonly
Authored by: bashonly
@bashonly bashonly removed the needs-testing Patch needs testing label Aug 1, 2024
@bashonly bashonly merged commit 919540a into yt-dlp:master Aug 1, 2024
6 checks passed
@bashonly bashonly deleted the fix/olymp-again branch August 1, 2024 20:25
@Cryosim
Copy link

Cryosim commented Aug 4, 2024

@bashonly Hi. Replays are broken again Paris 2024, won't downloading

[debug] Command-line config: ['-vU', 'https://olympics.com/en/paris-2024/videos/men-s-and-women-s-individual-eliminations-day-4-afternoon-archery-olympic-games-paris-2024']
[debug] Encodings: locale cp1251, fs utf-8, pref cp1251, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.08.01 from yt-dlp/yt-dlp [ffd7781d6] (pip)
[debug] Python 3.12.1 (CPython AMD64 64bit) - Windows-11-10.0.22631-SP0 (OpenSSL 3.0.11 19 Sep 2023)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, mutagen-1.47.0, requests-2.32.3, sqlite3-3.43.1, urllib3-2.2.2, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1830 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.08.01 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.08.01 from yt-dlp/yt-dlp)
[OlympicsReplay] Extracting URL: https://olympics.com/en/paris-2024/videos/men-s-and-women-s-individual-eliminations-day-4-afternoon-archery-olympic-games-paris-2024
[OlympicsReplay] men-s-and-women-s-individual-eliminations-day-4-afternoon-archery-olympic-games-paris-2024: Downloading webpage
[OlympicsReplay] men-s-and-women-s-individual-eliminations-day-4-afternoon-archery-olympic-games-paris-2024: Downloading tokenized m3u8 url
[OlympicsReplay] men-s-and-women-s-individual-eliminations-day-4-afternoon-archery-olympic-games-paris-2024: Downloading m3u8 information
ERROR: [OlympicsReplay] men-s-and-women-s-individual-eliminations-day-4-afternoon-archery-olympic-games-paris-2024: Failed to download m3u8 information: HTTP Error 403: Forbidden token format (caused by <HTTPError 403: Forbidden token format>)
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\common.py", line 740, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\olympics.py", line 107, in _real_extract
    if info := self._extract_from_nextjs_data(webpage, video_id):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\olympics.py", line 80, in _extract_from_nextjs_data
    formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\common.py", line 2041, in _extract_m3u8_formats_and_subtitles
    res = self._download_webpage_handle(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\common.py", line 960, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\common.py", line 909, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\common.py", line 896, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query, extensions))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 4165, in urlopen
    return self._request_director.send(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\networking\common.py", line 117, in send
    response = handler.send(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\networking\_helper.py", line 208, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\networking\common.py", line 340, in send
    return self._send(request)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mcmas\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\networking\_requests.py", line 365, in _send
    raise HTTPError(res, redirect_loop=max_redirects_exceeded)
yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden token format```
Link: https://metering.olympics.com/tokengenerator?url=https%3A%2F%2Fpar-ocsi-vod-f.ovpobs.tv%2Fvod%2Fpar100015400%2Fhls%2Findex.m3u8&service-id=vod&user-auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmxwYXRoIjoiL2VuL3BhcmlzLTIwMjQvdmlkZW9zL21lbi1zLWFuZC13b21lbi1zLWluZGl2aWR1YWwtZWxpbWluYXRpb25zLWRheS00LWFmdGVybm9vbi1hcmNoZXJ5LW9seW1waWMtZ2FtZXMtcGFyaXMtMjAyNCIsImdlbmVyYXRpb24iOiIxNzIyNzYwMjI0In0.eUPGmTvSEr5XSSvVAzVdxkOALxzXohFn6y4DFiDF2eg

Curl parser: 

curl "https://metering.olympics.com/tokengenerator?url=https%3A%2F%2Fpar-ocsi-vod-f.ovpobs.tv%2Fvod%2Fpar100015400%2Fhls%2Findex.m3u8&service-id=vod&user-auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmxwYXRoIjoiL2VuL3BhcmlzLTIwMjQvdmlkZW9zL21lbi1zLWFuZC13b21lbi1zLWluZGl2aWR1YWwtZWxpbWluYXRpb25zLWRheS00LWFmdGVybm9vbi1hcmNoZXJ5LW9seW1waWMtZ2FtZXMtcGFyaXMtMjAyNCIsImdlbmVyYXRpb24iOiIxNzIyNzYwMjI0In0.eUPGmTvSEr5XSSvVAzVdxkOALxzXohFn6y4DFiDF2eg"

  {
    "data": {
      "url": "https://par-ocsi-vod-f.ovpobs.tv/vod/par100015400/hls/index.m3u8?hdnts=exp=1722760336~acl=/vod/par100015400/hls/*~id=080-b56467e263~hmac=cb5de78c7446ace343dc170481857dbb66befb150c106269abcbf4ea6db9705e",
      "playid": "AMS;ams21081;1722760320636;2024-08-04T08:32:00.636Z;4177561561"
    }
  }

@bashonly
Copy link
Member Author

bashonly commented Aug 4, 2024

@Cryosim python -m pip install -U --pre "yt-dlp[default]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Olympics.com] Paris 2024 Unsupported URL / HTTP Error 403 Forbidden token format
2 participants