mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[pluralsight] Process all clip URLs (closes #10984)
This commit is contained in:
parent
9ce0077485
commit
f8ae2c7f30
1 changed files with 23 additions and 11 deletions
|
@ -4,7 +4,6 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
|
@ -242,9 +241,9 @@ def guess_allowed_qualities():
|
||||||
'quality': '%dx%d' % (f['width'], f['height']),
|
'quality': '%dx%d' % (f['width'], f['height']),
|
||||||
}
|
}
|
||||||
format_id = '%s-%s' % (ext, quality)
|
format_id = '%s-%s' % (ext, quality)
|
||||||
clip_url = self._download_webpage(
|
viewclip = self._download_json(
|
||||||
'%s/video/clips/viewclip' % self._API_BASE, display_id,
|
'%s/video/clips/viewclip' % self._API_BASE, display_id,
|
||||||
'Downloading %s URL' % format_id, fatal=False,
|
'Downloading %s viewclip JSON' % format_id, fatal=False,
|
||||||
data=json.dumps(clip_post).encode('utf-8'),
|
data=json.dumps(clip_post).encode('utf-8'),
|
||||||
headers={'Content-Type': 'application/json;charset=utf-8'})
|
headers={'Content-Type': 'application/json;charset=utf-8'})
|
||||||
|
|
||||||
|
@ -258,15 +257,28 @@ def guess_allowed_qualities():
|
||||||
random.randint(2, 5), display_id,
|
random.randint(2, 5), display_id,
|
||||||
'%(video_id)s: Waiting for %(timeout)s seconds to avoid throttling')
|
'%(video_id)s: Waiting for %(timeout)s seconds to avoid throttling')
|
||||||
|
|
||||||
if not clip_url:
|
if not viewclip:
|
||||||
continue
|
continue
|
||||||
f.update({
|
|
||||||
'url': clip_url,
|
clip_urls = viewclip.get('urls')
|
||||||
'ext': ext,
|
if not isinstance(clip_urls, list):
|
||||||
'format_id': format_id,
|
continue
|
||||||
'quality': quality_key(quality),
|
|
||||||
})
|
for clip_url_data in clip_urls:
|
||||||
formats.append(f)
|
clip_url = clip_url_data.get('url')
|
||||||
|
if not clip_url:
|
||||||
|
continue
|
||||||
|
cdn = clip_url_data.get('cdn')
|
||||||
|
clip_f = f.copy()
|
||||||
|
clip_f.update({
|
||||||
|
'url': clip_url,
|
||||||
|
'ext': ext,
|
||||||
|
'format_id': '%s-%s' % (format_id, cdn) if cdn else format_id,
|
||||||
|
'quality': quality_key(quality),
|
||||||
|
'source_preference': int_or_none(clip_url_data.get('rank')),
|
||||||
|
})
|
||||||
|
formats.append(clip_f)
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
duration = int_or_none(
|
duration = int_or_none(
|
||||||
|
|
Loading…
Reference in a new issue