Skip to content

Commit 545d6cb

Browse files
committed
[pornhub] Extract DASH and HLS formats from get_media end point (closes ytdl-org#28698)
1 parent 006eea5 commit 545d6cb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

youtube_dl/extractor/pornhub.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,16 @@ def parse_quality_items(quality_items):
398398
formats = []
399399

400400
def add_format(format_url, height=None):
401+
ext = determine_ext(format_url)
402+
if ext == 'mpd':
403+
formats.extend(self._extract_mpd_formats(
404+
format_url, video_id, mpd_id='dash', fatal=False))
405+
return
406+
if ext == 'm3u8':
407+
formats.extend(self._extract_m3u8_formats(
408+
format_url, video_id, 'mp4', entry_protocol='m3u8_native',
409+
m3u8_id='hls', fatal=False))
410+
return
401411
tbr = None
402412
mobj = re.search(r'(?P<height>\d+)[pP]?_(?P<tbr>\d+)[kK]', format_url)
403413
if mobj:
@@ -417,16 +427,6 @@ def add_format(format_url, height=None):
417427
r'/(\d{6}/\d{2})/', video_url, 'upload data', default=None)
418428
if upload_date:
419429
upload_date = upload_date.replace('/', '')
420-
ext = determine_ext(video_url)
421-
if ext == 'mpd':
422-
formats.extend(self._extract_mpd_formats(
423-
video_url, video_id, mpd_id='dash', fatal=False))
424-
continue
425-
elif ext == 'm3u8':
426-
formats.extend(self._extract_m3u8_formats(
427-
video_url, video_id, 'mp4', entry_protocol='m3u8_native',
428-
m3u8_id='hls', fatal=False))
429-
continue
430430
if '/video/get_media' in video_url:
431431
medias = self._download_json(video_url, video_id, fatal=False)
432432
if isinstance(medias, list):

0 commit comments

Comments
 (0)