Upgrade yt_dlp and download script

This commit is contained in:
2025-05-02 16:11:08 -05:00
parent 3a2e8eeb08
commit d68d9ce4f9
1194 changed files with 60099 additions and 44436 deletions

View File

@@ -3,13 +3,12 @@ import json
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
clean_html,
ExtractorError,
clean_html,
# remove_end,
str_or_none,
strip_or_none,
unified_timestamp,
# urljoin,
)
@@ -64,7 +63,7 @@ class PacktPubIE(PacktPubBaseIE):
headers['Authorization'] = 'Bearer ' + self._TOKEN
try:
video_url = self._download_json(
'https://services.packtpub.com/products-v1/products/%s/%s/%s' % (course_id, chapter_id, video_id), video_id,
f'https://services.packtpub.com/products-v1/products/{course_id}/{chapter_id}/{video_id}', video_id,
'Downloading JSON video', headers=headers)['data']
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
@@ -110,17 +109,16 @@ class PacktPubCourseIE(PacktPubBaseIE):
@classmethod
def suitable(cls, url):
return False if PacktPubIE.suitable(url) else super(
PacktPubCourseIE, cls).suitable(url)
return False if PacktPubIE.suitable(url) else super().suitable(url)
def _real_extract(self, url):
mobj = self._match_valid_url(url)
url, course_id = mobj.group('url', 'id')
course = self._download_json(
self._STATIC_PRODUCTS_BASE + '%s/toc' % course_id, course_id)
self._STATIC_PRODUCTS_BASE + f'{course_id}/toc', course_id)
metadata = self._download_json(
self._STATIC_PRODUCTS_BASE + '%s/summary' % course_id,
self._STATIC_PRODUCTS_BASE + f'{course_id}/summary',
course_id, fatal=False) or {}
entries = []