Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/yt-dlp/yt-dlp into ytdlp
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/yt-dlp/yt-dlp:
  Fix `original_url` in playlists
  [FFmpegVideoConvertor] Add `gif` to `--recode-video`
  [extractor] Let `_extract_format` functions obey `--ignore-no-formats`
  • Loading branch information
Lesmiscore committed Dec 23, 2022
2 parents 289e89f + 8791e78 commit f7c233c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1013,11 +1013,11 @@ You can also fork the project on GitHub and run your fork's [build workflow](.gi
specific bitrate like 128K (default 5)
--remux-video FORMAT Remux the video into another container if
necessary (currently supported: avi, flv,
mkv, mov, mp4, webm, aac, aiff, alac, flac,
m4a, mka, mp3, ogg, opus, vorbis, wav). If
target container does not support the
video/audio codec, remuxing will fail. You
can specify multiple rules; e.g.
gif, mkv, mov, mp4, webm, aac, aiff, alac,
flac, m4a, mka, mp3, ogg, opus, vorbis,
wav). If target container does not support
the video/audio codec, remuxing will fail.
You can specify multiple rules; e.g.
"aac>m4a/mov>mp4/mkv" will remux aac to m4a,
mov to mp4 and anything else to mkv
--recode-video FORMAT Re-encode the video into another format if
Expand Down
4 changes: 2 additions & 2 deletions yt_dlp/YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1703,8 +1703,8 @@ def process_ie_result(self, ie_result, download=True, extra_info=None):
if result_type in ('url', 'url_transparent'):
ie_result['url'] = sanitize_url(
ie_result['url'], scheme='http' if self.params.get('prefer_insecure') else 'https')
if ie_result.get('original_url'):
extra_info.setdefault('original_url', ie_result['original_url'])
if ie_result.get('original_url') and not extra_info.get('original_url'):
extra_info = {'original_url': ie_result['original_url'], **extra_info}

extract_flat = self.params.get('extract_flat', False)
if ((extract_flat == 'in_playlist' and 'playlist' in extra_info)
Expand Down
16 changes: 16 additions & 0 deletions yt_dlp/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,9 @@ def _sleep(self, timeout, video_id, msg_template=None):
def _extract_f4m_formats(self, manifest_url, video_id, preference=None, quality=None, f4m_id=None,
transform_source=lambda s: fix_xml_ampersands(s).strip(),
fatal=True, m3u8_id=None, data=None, headers={}, query={}):
if self.get_param('ignore_no_formats_error'):
fatal = False

res = self._download_xml_handle(
manifest_url, video_id, 'Downloading f4m manifest',
'Unable to download f4m manifest',
Expand Down Expand Up @@ -1966,6 +1969,9 @@ def _extract_m3u8_formats_and_subtitles(
query={},
json_body=None, form_params=None, body_encoding=None):

if self.get_param('ignore_no_formats_error'):
fatal = False

if not m3u8_url:
if errnote is not False:
errnote = errnote or 'Failed to obtain m3u8 URL'
Expand Down Expand Up @@ -2251,6 +2257,9 @@ def _xpath_ns(path, namespace=None):
return '/'.join(out)

def _extract_smil_formats_and_subtitles(self, smil_url, video_id, fatal=True, f4m_params=None, transform_source=None):
if self.get_param('ignore_no_formats_error'):
fatal = False

res = self._download_smil(smil_url, video_id, fatal=fatal, transform_source=transform_source)
if res is False:
assert not fatal
Expand Down Expand Up @@ -2526,6 +2535,10 @@ def _extract_mpd_formats(self, *args, **kwargs):
def _extract_mpd_formats_and_subtitles(
self, mpd_url, video_id, mpd_id=None, note=None, errnote=None,
fatal=True, data=None, headers={}, query={}):

if self.get_param('ignore_no_formats_error'):
fatal = False

res = self._download_xml_handle(
mpd_url, video_id,
note='Downloading MPD manifest' if note is None else note,
Expand Down Expand Up @@ -2896,6 +2909,9 @@ def _extract_ism_formats(self, *args, **kwargs):
return fmts

def _extract_ism_formats_and_subtitles(self, ism_url, video_id, ism_id=None, note=None, errnote=None, fatal=True, data=None, headers={}, query={}):
if self.get_param('ignore_no_formats_error'):
fatal = False

res = self._download_xml_handle(
ism_url, video_id,
note='Downloading ISM manifest' if note is None else note,
Expand Down
5 changes: 4 additions & 1 deletion yt_dlp/postprocessor/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,10 @@ def run(self, information):


class FFmpegVideoConvertorPP(FFmpegPostProcessor):
SUPPORTED_EXTS = (*MEDIA_EXTENSIONS.common_video, *sorted(MEDIA_EXTENSIONS.common_audio + ('aac', 'vorbis')))
SUPPORTED_EXTS = (
*sorted((*MEDIA_EXTENSIONS.common_video, 'gif')),
*sorted((*MEDIA_EXTENSIONS.common_audio, 'aac', 'vorbis')),
)
FORMAT_RE = create_mapping_re(SUPPORTED_EXTS)
_ACTION = 'converting'

Expand Down

0 comments on commit f7c233c

Please sign in to comment.