yt-dlp: [Telecinco] Failed to download m3u8 information: HTTP Error 403: Forbidden

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Please make sure the question is worded well enough to be understood

I want to download a program from the mitele website and it gives me this error.

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

PS C:\yt-dllp> .\yt-dlp.exe -vU https://www.telecinco.es/el-rival-mas-debil/a-la-carta/20240911/programa-2-completo-video-11-septiembre_18_013427350.html -f best
[debug] Command-line config: ['-vU', 'https://www.telecinco.es/el-rival-mas-debil/a-la-carta/20240911/programa-2-completo-video-11-septiembre_18_013427350.html', '-f', 'best']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.08.06 from yt-dlp/yt-dlp [4d9231208] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22631-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-116990-g4646a74d1e-20240911 (setts), ffprobe N-116990-g4646a74d1e-20240911
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.32.3, sqlite3-3.35.5, urllib3-2.2.2, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
WARNING: "-f best" selects the best pre-merged format which is often not the best option.
         To let yt-dlp download and merge the best available formats, simply do not pass any format selection.
         If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning
[debug] Loaded 1830 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.08.06 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.08.06 from yt-dlp/yt-dlp)
[Telecinco] Extracting URL: https://www.telecinco.es/el-rival-mas-debil/a-la-carta/20240911/programa-2-completo-video-11-septiembre_18_013427350.html
[Telecinco] programa-2-completo-video-11-septiembre_18_013427350: Downloading webpage
[Telecinco] 5de0091f-23ca-44f0-9a5c-1f18b607732f: Downloading config JSON
[Telecinco] 5de0091f-23ca-44f0-9a5c-1f18b607732f: Downloading JSON metadata
[Telecinco] 5de0091f-23ca-44f0-9a5c-1f18b607732f: Downloading JSON metadata
[Telecinco] 5de0091f-23ca-44f0-9a5c-1f18b607732f: Downloading JSON metadata
[Telecinco] 5de0091f-23ca-44f0-9a5c-1f18b607732f: Downloading m3u8 information
ERROR: [Telecinco] programa-2-completo-video-11-septiembre_18_013427350: Failed to download m3u8 information: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)
  File "yt_dlp\extractor\common.py", line 740, in extract
  File "yt_dlp\extractor\telecinco.py", line 138, in _real_extract
  File "yt_dlp\extractor\telecinco.py", line 102, in _parse_content
  File "yt_dlp\extractor\common.py", line 2019, in _extract_m3u8_formats
  File "yt_dlp\extractor\common.py", line 2041, in _extract_m3u8_formats_and_subtitles
  File "yt_dlp\extractor\common.py", line 960, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 909, in _request_webpage

  File "yt_dlp\extractor\common.py", line 896, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 4165, in urlopen
  File "yt_dlp\networking\common.py", line 117, in send
  File "yt_dlp\networking\_helper.py", line 208, in wrapper
  File "yt_dlp\networking\common.py", line 340, in send
  File "yt_dlp\networking\_requests.py", line 365, in _send
yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

@Juancafr

He dejado el mensaje para los que mantienen el repositorio sepan cual es el problema y como solucionarlo. Si quieres aplicar tu el fix manualmente tienes que encontrar donde tienes instalado yt-dlp Por ejemplo, en linux a mi se me ha instalado en esta carpeta /usr/lib/python3.12/site-packages/yt_dlp pero variara dependiendo de tu systema operativo.

Una vez hayas encontrado la carpeta busca el archivo networking/common.py#336 es decir, dentro de la carpeta networking el archivo common.py y vas a la linea 336 (esto es teniendo en cuenta que tienes la ultima version de yt-dlp en tu sistema) ahi encontraras la siguiente funcion, si no tenemos la misma version igual no esta en la linea 336 pero deberias poder encontrar esta misma funcion en alguna otra parte de este archivo

@wrap_request_errors
    def send(self, request: Request) -> Response:
        if not isinstance(request, Request):
            raise TypeError('Expected an instance of Request')
      
        return self._send(request)

pues bien, reemplaza esa funcion por este codigo

@wrap_request_errors
    def send(self, request: Request) -> Response:
        if not isinstance(request, Request):
            raise TypeError('Expected an instance of Request')
        
        if 'vbdk.mediaset.es' in request.url:
            request.headers = {
                'accept': '*/*',
                'accept-language': 'en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7,ca;q=0.6',
                'cache-control': 'no-cache',
                'origin': 'https://www.mitele.es/',
                'pragma': 'no-cache',
                'priority': 'u=1, i',
                'referer': request.url,
                'sec-ch-ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
                'sec-ch-ua-mobile': '?0',
                'sec-ch-ua-platform': '"Linux"',
                'sec-fetch-dest': 'empty',
                'sec-fetch-mode': 'cors',
                'sec-fetch-site': 'cross-site',
                'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
            }
        return self._send(request)

Eso son los pasos que me han funcionado a mi, es un parche guarrero y deberia solucionarse de otra manera mejor, pero asi funciona de momento

do NOT edit yt_dlp/networking/common.py, that is not the correct approach to solving this issue; doing so will break countless other extractors/sites

The issue is that requests to vbdk.mediaset.es are returning 403 if http headers doesn’t look like http headers sent by a web browser I can imagine.

I am not familiar with this codebase so I don’t know which would be the better way of applying this fix.

I haven’t taken the time to determine which headers are actually required, but this works at the moment:

file: networking/common.py#336

    @wrap_request_errors
    def send(self, request: Request) -> Response:
        if not isinstance(request, Request):
            raise TypeError('Expected an instance of Request')
        
        if 'vbdk.mediaset.es' in request.url:
            request.headers = {
                'accept': '*/*',
                'accept-language': 'en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7,ca;q=0.6',
                'cache-control': 'no-cache',
                'origin': 'https://www.mitele.es',
                'pragma': 'no-cache',
                'priority': 'u=1, i',
                'referer': 'https://www.mitele.es/programas-tv/horizonte/temporada-5/programa-169-40_013384375/player/',
                'sec-ch-ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
                'sec-ch-ua-mobile': '?0',
                'sec-ch-ua-platform': '"Linux"',
                'sec-fetch-dest': 'empty',
                'sec-fetch-mode': 'cors',
                'sec-fetch-site': 'cross-site',
                'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
            }
        return self._send(request)

I was trying to download https://www.mitele.es/programas-tv/horizonte/temporada-5/programa-169-40_013384375/player/ so if it is required the referer header has to be set accordingly to the url you want to download.