bork
bork

Reputation: 21

Manifest error pops up when trying to download certain videos for discord.py music bot

I'm trying to make a discord music bot. I'm using youtube-dl to retrieve the info and ffmpeg to play the audio out. My bot has no problems downloading videos and everything is working fine. But when I tried downloading certain videos, this error popped up:

[dash @ 0x7fe45a801200] Manifest too large: 65055
https://manifest.googlevideo.com/api/manifest/dash/expire/1606336104/ei/CGq-X4G6Htauz7sPrZuCsA8/ip/14.192.212.39/id/64a943d43b8f53eb/source/youtube/requiressl/yes/playback_host/r5---sn-h5mpn-30ae.googlevideo.com/mh/Go/mm/31%2C29/mn/sn-h5mpn-30ae%2Csn-30a7rn7l/ms/au%2Crdu/mv/m/mvi/5/pl/24/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/533750/vprv/1/mt/1606314038/fvip/5/keepalive/yes/beids/23927369/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRQIhAOn6Br0QsuXc-3unfhYdzXVXcydzVWioIQlKvv2U4i3OAiB6ApoiqFoPvE3YKYGPbRiId_bHQYO8zsawGGPMidYGAA%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIhANmxfRNBI4wSJo6trsKkq8GinQ-ADMxgHRmelBwM-GEAAiAafey9YRrZz1h1S6PzV3u0S6IsZUKscGrrGP9Pofv2uQ%3D%3D: Invalid data found when processing input

After trying to download other videos, which have no problem at all, I found out that the videos showing these errors have an extra step that downloads MPD manifest. I would try to download videos that are way larger and it would work, but it's just these certain videos, with the duration of about 7-10 minutes, that would have these errors. I'm really lost.

This is my code for playing the videos in the voice channels:

voice = get(client.voice_clients, guild = ctx.guild)
with YoutubeDL(ydl_opts) as ydl:
                info = ydl.extract_info(url[playlist], download = False)

URL = info['formats'][0]['url']
voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))

Upvotes: 2

Views: 821

Answers (1)

Pedro Queiroga
Pedro Queiroga

Reputation: 391

I was faced with this issue too. Searching around I found this thread: ffmpeg "Manifest too large" when downloading youtube video. So what I wanted to do was youtube-dl --youtube-skip-dash-manifest, but since we're running it from python it is a bit different. In order to figure out what I needed to do, I went to a python shell:

$ python -i
Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import youtube_dl as ytdl
>>> help(ytdl)

This brings up YoutubeDL's documentation. Type "/" in order to start a search, then type your search string. I searched for "manifest" and pressed enter. It brought this up:

     |  youtube_include_dash_manifest: If True (default), DASH manifests and related
     |                      data will be downloaded and processed by extractor.
     |                      You can reduce network I/O by disabling it if you don't
     |                      care about DASH.

Which looks like it is exactly what I needed. I then included that key in my dictionary (your ydl_opts), as such:

ydl_opts = {
    'quiet': False,
    'default_search': 'ytsearch',
    'format': 'bestaudio/best',
    'youtube_include_dash_manifest': False,
}

This solved my problem, hope it solves yours too.

Upvotes: 1

Related Questions