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

Video downloads using binary but fails with "ERROR: requested format not available" in python? #28523

Closed
Elite opened this issue Mar 23, 2021 · 0 comments

Comments

@Elite
Copy link

Elite commented Mar 23, 2021

This code:

from __future__ import unicode_literals
import youtube_dl


class MyLogger(object):
    def debug(self, msg):
        print(msg)

    def warning(self, msg):
        print(msg)

    def error(self, msg):
        print(msg)


def my_hook(d):
    if d['status'] == 'finished':
        print('Done downloading, now converting ...')


ydl_options = {
    'continuedl': True,
    'format': '137/248',
    'cache-dir':'/var/www/.cache/youtube-dl',
    'verbose':True
    }

with youtube_dl.YoutubeDL(ydl_options) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=7uq7DiKg9IQ'])

fails in python with error:

python basic_python_youtubedl.py 
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.03.14
[debug] Git HEAD: 10cd2003b
[debug] Python version 2.7.16 (CPython) - Linux-4.19.0-6-amd64-x86_64-with-debian-10.2
[debug] exe versions: ffmpeg 4.2.1, ffprobe 4.2.1
[debug] Proxy map: {}
[youtube] 7uq7DiKg9IQ: Downloading webpage
ERROR: requested format not available
Traceback (most recent call last):
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 806, in wrapper
    return func(self, *args, **kwargs)
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 838, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 872, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 1675, in process_video_result
    expected=True)
ExtractorError: requested format not available

Traceback (most recent call last):
  File "basic_python_youtubedl.py", line 29, in <module>
    ydl.download(['https://www.youtube.com/watch?v=7uq7DiKg9IQ'])
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 2060, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 799, in extract_info
    return self.__extract_info(url, ie, download, extra_info, process)
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 815, in wrapper
    self.report_error(compat_str(e), e.format_traceback())
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 628, in report_error
    self.trouble(error_message, tb)
  File "/var/www/v3/youtube-dl/youtube_dl/YoutubeDL.py", line 598, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: requested format not available

Same formats downloads fine with binary and the formats are also shown as available when checking with binary:


youtube-dl -v -F 7uq7DiKg9IQ
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'7uq7DiKg9IQ']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.03.14
[debug] Python version 2.7.16 (CPython) - Linux-4.19.0-6-amd64-x86_64-with-debian-10.2
[debug] exe versions: ffmpeg 4.2.1, ffprobe 4.2.1
[debug] Proxy map: {}
[youtube] 7uq7DiKg9IQ: Downloading webpage
[youtube] 7uq7DiKg9IQ: Downloading MPD manifest
[info] Available formats for 7uq7DiKg9IQ:
format code  extension  resolution note
139          m4a        audio only DASH audio   54k , m4a_dash container, mp4a.40.5 (22050Hz), 31.75MiB
251          webm       audio only tiny   95k , webm_dash container, opus @ 95k (48000Hz), 61.87MiB
140          m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 84.26MiB
278          webm       256x144    DASH video   95k , webm_dash container, vp9, 24fps, video only
160          mp4        256x144    DASH video  108k , mp4_dash container, avc1.4d400b, 24fps, video only
242          webm       426x240    DASH video  220k , webm_dash container, vp9, 24fps, video only
133          mp4        426x240    DASH video  242k , mp4_dash container, avc1.4d400c, 24fps, video only
134          mp4        640x360    360p  355k , mp4_dash container, avc1.4d401e@ 355k, 24fps, video only, 231.40MiB
243          webm       640x360    DASH video  405k , webm_dash container, vp9, 24fps, video only
244          webm       854x480    DASH video  752k , webm_dash container, vp9, 24fps, video only
135          mp4        854x480    DASH video 1155k , mp4_dash container, avc1.4d4014, 24fps, video only
247          webm       1280x720   DASH video 1505k , webm_dash container, vp9, 24fps, video only
136          mp4        1280x720   DASH video 2310k , mp4_dash container, avc1.4d4016, 24fps, video only
248          webm       1920x1080  DASH video 2646k , webm_dash container, vp9, 24fps, video only
137          mp4        1920x1080  DASH video 4331k , mp4_dash container, avc1.64001e, 24fps, video only
18           mp4        640x360    360p  383k , avc1.42001E, 24fps, mp4a.40.2 (44100Hz), 249.85MiB
22           mp4        1280x720   720p 1699k , avc1.64001F, 24fps, mp4a.40.2 (44100Hz) (best)
@dstftw dstftw closed this as completed in 5208ae9 Mar 23, 2021
github-actions bot added a commit to hellopony/youtube-dl that referenced this issue Mar 24, 2021
* https://github.com/ytdl-org/youtube-dl:
  [ard] improve clip id extraction(ytdl-org#22724)(closes ytdl-org#28528)
  release 2021.03.25
  [ChangeLog] Actualize [ci skip]
  [zoom] Add new extractor(closes ytdl-org#16597, closes ytdl-org#27002, closes ytdl-org#28531)
  [extractor] escape forgotten dot for hostnames in regular expression (ytdl-org#28530)
  [bbc] fix BBC IPlayer Episodes/Group extraction(closes ytdl-org#28360)
  [youtube] Fix default value for youtube_include_dash_manifest (closes ytdl-org#28523)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant