From e6e12b1d1b9796ca4f4b073e61bb1927a96497f7 Mon Sep 17 00:00:00 2001 From: Piero Macaluso Date: Thu, 20 Jan 2022 15:16:12 +0100 Subject: [PATCH 1/3] fix: SkylineWebcams extractor SkylineWebcams extractor was not working. Here are the list of changes to make it work: 1. Update the regex to extract the stream URL from the webpage. In the webpage there is just a variable in the form `livee.m3u8?a=`. The usage of that link by appending it to `https://hd-auth.skylinewebcams.com/` do not work. The solution was to extract just the `?a=` area and appending it to `https://hd-auth.skylinewebcams.com/live.m3u8`. The extractor works properly. 2. Updated `_TEST` with a new `url`. The old one was disabled. It solves #28873. --- youtube_dl/extractor/skylinewebcams.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/skylinewebcams.py b/youtube_dl/extractor/skylinewebcams.py index b7f8ac736..a82762796 100644 --- a/youtube_dl/extractor/skylinewebcams.py +++ b/youtube_dl/extractor/skylinewebcams.py @@ -7,7 +7,7 @@ from .common import InfoExtractor class SkylineWebcamsIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?skylinewebcams\.com/[^/]+/webcam/(?:[^/]+/)+(?P[^/]+)\.html' _TEST = { - 'url': 'https://www.skylinewebcams.com/it/webcam/italia/lazio/roma/scalinata-piazza-di-spagna-barcaccia.html', + 'url': 'https://www.skylinewebcams.com/it/webcam/italia/lazio/roma/piazza-di-spagna.html', 'info_dict': { 'id': 'scalinata-piazza-di-spagna-barcaccia', 'ext': 'mp4', @@ -24,10 +24,9 @@ class SkylineWebcamsIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - - stream_url = self._search_regex( - r'(?:url|source)\s*:\s*(["\'])(?P(?:https?:)?//.+?\.m3u8.*?)\1', webpage, - 'stream url', group='url') + stream_url = 'https://hd-auth.skylinewebcams.com/live.m3u8' + self._search_regex( + r'(?:url|source)\s*:\s*(["\'])(livee\.m3u8(?P\?a=\w+))\1', webpage, + 'stream url', group='a_param') title = self._og_search_title(webpage) description = self._og_search_description(webpage) From b50cc676e331c5f1d932dabb063108bc78d37c34 Mon Sep 17 00:00:00 2001 From: Piero Macaluso Date: Thu, 20 Jan 2022 16:01:32 +0100 Subject: [PATCH 2/3] Update test info --- youtube_dl/extractor/skylinewebcams.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/skylinewebcams.py b/youtube_dl/extractor/skylinewebcams.py index a82762796..483e90e1b 100644 --- a/youtube_dl/extractor/skylinewebcams.py +++ b/youtube_dl/extractor/skylinewebcams.py @@ -7,12 +7,12 @@ from .common import InfoExtractor class SkylineWebcamsIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?skylinewebcams\.com/[^/]+/webcam/(?:[^/]+/)+(?P[^/]+)\.html' _TEST = { - 'url': 'https://www.skylinewebcams.com/it/webcam/italia/lazio/roma/piazza-di-spagna.html', + 'url': 'https://www.skylinewebcams.com/it/webcam/italia/lazio/roma/scalinata-piazza-di-spagna-barcaccia.html', 'info_dict': { - 'id': 'scalinata-piazza-di-spagna-barcaccia', + 'id': 'piazza-di-spagna', 'ext': 'mp4', - 'title': 're:^Live Webcam Scalinata di Piazza di Spagna - La Barcaccia [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', - 'description': 'Roma, veduta sulla Scalinata di Piazza di Spagna e sulla Barcaccia', + 'title': 're:^【LIVE】 Webcam Roma - Piazza di Spagna | SkylineWebcams [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', + 'description': 'Guarda la webcam su Piazza di Spagna a Roma! Scopri in diretta il traffico dei turisti ai piedi della scalinata di Trinità dei Monti ed intorno alla Barcaccia', 'is_live': True, }, 'params': { @@ -24,6 +24,7 @@ class SkylineWebcamsIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) + print(webpage) stream_url = 'https://hd-auth.skylinewebcams.com/live.m3u8' + self._search_regex( r'(?:url|source)\s*:\s*(["\'])(livee\.m3u8(?P\?a=\w+))\1', webpage, 'stream url', group='a_param') From c010f357da27efa5b5be6eacd20f9b068fca7db6 Mon Sep 17 00:00:00 2001 From: Piero Macaluso Date: Thu, 20 Jan 2022 17:09:33 +0100 Subject: [PATCH 3/3] Remove an unuseful print --- youtube_dl/extractor/skylinewebcams.py | 1 - 1 file changed, 1 deletion(-) diff --git a/youtube_dl/extractor/skylinewebcams.py b/youtube_dl/extractor/skylinewebcams.py index 483e90e1b..a7f94b59d 100644 --- a/youtube_dl/extractor/skylinewebcams.py +++ b/youtube_dl/extractor/skylinewebcams.py @@ -24,7 +24,6 @@ class SkylineWebcamsIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - print(webpage) stream_url = 'https://hd-auth.skylinewebcams.com/live.m3u8' + self._search_regex( r'(?:url|source)\s*:\s*(["\'])(livee\.m3u8(?P\?a=\w+))\1', webpage, 'stream url', group='a_param')