aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormilkknife <111794344+milkknife@users.noreply.github.com>2022-12-08 17:56:36 +0100
committerGitHub <noreply@github.com>2022-12-08 22:26:36 +0530
commit85a802969ebb62ff57347110f7ad0d87099e65e7 (patch)
treeccd3b3e95637911e175bcc6431608c2bbee7ba4c
parent72f96c55662c688a15ed00ffa661546156f7e461 (diff)
downloadhypervideo-pre-85a802969ebb62ff57347110f7ad0d87099e65e7.tar.lz
hypervideo-pre-85a802969ebb62ff57347110f7ad0d87099e65e7.tar.xz
hypervideo-pre-85a802969ebb62ff57347110f7ad0d87099e65e7.zip
[extractor/webcamerapl] Add extractor (#5715)
Authored by: milkknife
-rw-r--r--yt_dlp/extractor/_extractors.py1
-rw-r--r--yt_dlp/extractor/webcamerapl.py44
2 files changed, 45 insertions, 0 deletions
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py
index b1d0a9fb0..c3eb2bb77 100644
--- a/yt_dlp/extractor/_extractors.py
+++ b/yt_dlp/extractor/_extractors.py
@@ -2194,6 +2194,7 @@ from .wdr import (
WDRElefantIE,
WDRMobileIE,
)
+from .webcamerapl import WebcameraplIE
from .webcaster import (
WebcasterIE,
WebcasterFeedIE,
diff --git a/yt_dlp/extractor/webcamerapl.py b/yt_dlp/extractor/webcamerapl.py
new file mode 100644
index 000000000..a02d9519c
--- /dev/null
+++ b/yt_dlp/extractor/webcamerapl.py
@@ -0,0 +1,44 @@
+import codecs
+
+from .common import InfoExtractor
+
+
+class WebcameraplIE(InfoExtractor):
+ _VALID_URL = r'https?://(?P<id>[\w-]+)\.webcamera\.pl'
+ _TESTS = [{
+ 'url': 'https://warszawa-plac-zamkowy.webcamera.pl',
+ 'info_dict': {
+ 'id': 'warszawa-plac-zamkowy',
+ 'ext': 'mp4',
+ 'title': r're:WIDOK NA PLAC ZAMKOWY W WARSZAWIE \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
+ 'live_status': 'is_live',
+ }
+ }, {
+ 'url': 'https://gdansk-stare-miasto.webcamera.pl/',
+ 'info_dict': {
+ 'id': 'gdansk-stare-miasto',
+ 'ext': 'mp4',
+ 'title': r're:GDAƃSK - widok na Stare Miasto \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
+ 'live_status': 'is_live',
+ }
+ }]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage(url, video_id)
+
+ rot13_m3u8_url = self._search_regex(r'data-src\s*=\s*"(uggc[^"]+\.z3h8)"',
+ webpage, 'm3u8 url', default=None)
+ if not rot13_m3u8_url:
+ self.raise_no_formats('No video/audio found at the provided url', expected=True)
+
+ m3u8_url = codecs.decode(rot13_m3u8_url, 'rot-13')
+ formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, live=True)
+
+ return {
+ 'id': video_id,
+ 'title': self._html_search_regex(r'<h1\b[^>]*>([^>]+)</h1>', webpage, 'title'),
+ 'formats': formats,
+ 'subtitles': subtitles,
+ 'is_live': True,
+ }