1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-26 04:02:11 +00:00

Automatically obtain NextJS buildId and change item to video-item

This commit is contained in:
Bart Broere 2024-10-20 11:49:09 +02:00
parent 6de650f51f
commit c748eca829

View file

@ -221,13 +221,14 @@ class SchoolTVIE(NPOIE):
def _real_extract(self, url): def _real_extract(self, url):
video_id = url.rstrip('/').split('/')[-1] video_id = url.rstrip('/').split('/')[-1]
# TODO Find out how we could obtain this automatically build_id = self._search_nextjs_data(
# Otherwise this extractor might break each time SchoolTV deploys a new release self._download_webpage(url, video_id),
build_id = 'b7eHUzAVO7wHXCopYxQhV' video_id,
)['buildId']
metadata_url = 'https://schooltv.nl/_next/data/' \ metadata_url = 'https://schooltv.nl/_next/data/' \
+ build_id \ + build_id \
+ '/item/' \ + '/video-item/' \
+ video_id + '.json' + video_id + '.json'
metadata = self._download_json(metadata_url, metadata = self._download_json(metadata_url,
@ -304,7 +305,7 @@ class VPROIE(NPOIE):
formats = [] formats = []
for result in results: for result in results:
formats.extend(self._extract_formats_by_product_id(result, video_id)) formats.extend(self._extract_formats_by_product_id(result, video_id))
break # TODO find a better solution, VPRO pages can have multiple videos embedded break
if not formats: if not formats:
raise ExtractorError('Could not find a POMS product id in the provided URL, ' raise ExtractorError('Could not find a POMS product id in the provided URL, '