aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/webcamerapl.py
diff options
context:
space:
mode:
authorJesus <heckyel@riseup.net>2023-09-04 01:37:13 +0800
committerJesus <heckyel@riseup.net>2023-09-04 01:37:13 +0800
commit52d97967fb3b196759c19ae40a4c63dbb2557a19 (patch)
treec49e561914d2d01f2ef022443d304728a08dac25 /yt_dlp/extractor/webcamerapl.py
parenta9d0affcff8d499212852d9c711112b29defe612 (diff)
parent2301b5c1b77a65abbb46b72f91e1e4666fd5d985 (diff)
downloadhypervideo-pre-52d97967fb3b196759c19ae40a4c63dbb2557a19.tar.lz
hypervideo-pre-52d97967fb3b196759c19ae40a4c63dbb2557a19.tar.xz
hypervideo-pre-52d97967fb3b196759c19ae40a4c63dbb2557a19.zip
update from upstream
Diffstat (limited to 'yt_dlp/extractor/webcamerapl.py')
-rw-r--r--yt_dlp/extractor/webcamerapl.py44
1 files changed, 44 insertions, 0 deletions
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,
+ }