From 28ba01f1ccfc5560be7d027b1669822e44d4143f Mon Sep 17 00:00:00 2001 From: Bart Broere Date: Tue, 5 Mar 2024 13:43:56 +0100 Subject: [PATCH] Add Ongehoord Nederland and test URL for BNNVARA --- youtube_dl/extractor/extractors.py | 2 +- youtube_dl/extractor/npo.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 696fd8e1e..802e498f9 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -847,7 +847,7 @@ from .nowness import ( NownessSeriesIE, ) from .noz import NozIE -from .npo import BNNVaraIE, NPOIE +from .npo import BNNVaraIE, NPOIE, ONIE from .npr import NprIE from .nrk import ( NRKIE, diff --git a/youtube_dl/extractor/npo.py b/youtube_dl/extractor/npo.py index 53fd816f7..d8573d343 100644 --- a/youtube_dl/extractor/npo.py +++ b/youtube_dl/extractor/npo.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals import json +import re from .common import InfoExtractor from ..utils import ( @@ -129,6 +130,9 @@ class BNNVaraIE(NPOIE): IE_NAME = 'bnnvara' IE_DESC = 'bnnvara.nl' _VALID_URL = r'https?://(?:www\.)?bnnvara\.nl/videos/[0-9]*' + _TESTS = [{ + 'url': 'https://www.bnnvara.nl/videos/27455', + }] def _real_extract(self, url): url = url.rstrip('/') @@ -159,3 +163,29 @@ class BNNVaraIE(NPOIE): 'formats': formats, 'thumbnail': media.get('data', {}).get('player', {}).get('image').get('url'), } + + +class ONIE(NPOIE): + IE_NAME = 'on' + IE_DESC = 'ongehoordnederland.tv' + _VALID_URL = r'https?://(?:www\.)?ongehoordnederland.tv/.*' + _TESTS = [{ + 'url': 'https://ongehoordnederland.tv/2024/03/01/korte-clips/heeft-preppen-zin-betwijfel-dat-je-daar-echt-iets-aan-zult-hebben-bij-oorlog-lydia-daniel/', + }] + + def _real_extract(self, url): + video_id = url.rstrip('/').split('/')[-1] + page, _ = self._download_webpage_handle(url, video_id) + results = re.findall("page: '(.+)'", page) + formats = [] + for result in results: + formats.extend(self._download_by_product_id(result, video_id)) + + if not formats: + raise ExtractorError('Could not find a POMS product id in the provided URL.') + + return { + 'id': video_id, + 'title': video_id, + 'formats': formats, + }