[rh:websockets] Support websockets 14.0+ (#11616)
[yt-dlp3.git] / yt_dlp / extractor / germanupa.py
blobe40f016b2f2eff1acd664d27989cebf0ffcd3ffe
1 from .common import InfoExtractor
2 from .vimeo import VimeoIE
3 from ..utils import (
4 parse_qs,
5 traverse_obj,
6 url_or_none,
10 class GermanupaIE(InfoExtractor):
11 IE_DESC = 'germanupa.de'
12 _VALID_URL = r'https?://germanupa\.de/mediathek/(?P<id>[\w-]+)'
13 _TESTS = [{
14 'url': 'https://germanupa.de/mediathek/4-figma-beratung-deine-sprechstunde-fuer-figma-fragen',
15 'info_dict': {
16 'id': '909179246',
17 'title': 'Tutorial: #4 Figma Beratung - Deine Sprechstunde für Figma-Fragen',
18 'ext': 'mp4',
19 'uploader': 'German UPA',
20 'uploader_id': 'germanupa',
21 'thumbnail': 'https://i.vimeocdn.com/video/1792564420-7415283ccef8bf8702dab8c6b7515555ceeb7a1c11371ffcc133b8e887dbf70e-d_1280',
22 'uploader_url': 'https://vimeo.com/germanupa',
23 'duration': 3987,
25 'expected_warnings': ['Failed to parse XML: not well-formed'],
26 'params': {'skip_download': 'm3u8'},
27 }, {
28 'note': 'audio, uses GenericIE',
29 'url': 'https://germanupa.de/mediathek/live-vom-ux-festival-neuigkeiten-von-figma-jobmarkt-agenturszene-interview-zu-sustainable',
30 'info_dict': {
31 'id': '1867346676',
32 'title': 'Live vom UX Festival: Neuigkeiten von Figma, Jobmarkt, Agenturszene & Interview zu Sustainable UX',
33 'ext': 'opus',
34 'timestamp': 1720545088,
35 'upload_date': '20240709',
36 'duration': 3910.557,
37 'like_count': int,
38 'description': 'md5:db2aed5ff131e177a7b33901e9a8db05',
39 'uploader': 'German UPA',
40 'repost_count': int,
41 'genres': ['Science'],
42 'license': 'all-rights-reserved',
43 'uploader_url': 'https://soundcloud.com/user-80097677',
44 'uploader_id': '471579486',
45 'view_count': int,
46 'comment_count': int,
47 'thumbnail': 'https://i1.sndcdn.com/artworks-oCti2e9GhaZFWBqY-48ybGw-original.jpg',
49 }, {
50 'note': 'Nur für Mitglieder/Just for members',
51 'url': 'https://germanupa.de/mediathek/ux-festival-2024-usability-tests-und-ai',
52 'info_dict': {
53 'id': '986994430',
54 'title': 'UX Festival 2024 "Usability Tests und AI" von Lennart Weber',
55 'ext': 'mp4',
56 'release_date': '20240719',
57 'uploader_url': 'https://vimeo.com/germanupa',
58 'timestamp': 1721373980,
59 'license': 'by-sa',
60 'like_count': int,
61 'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f51d7506a3e8416763ba6dbf465732b165c5c-d_1280',
62 'duration': 2146,
63 'release_timestamp': 1721373980,
64 'uploader': 'German UPA',
65 'uploader_id': 'germanupa',
66 'upload_date': '20240719',
67 'comment_count': int,
69 'expected_warnings': ['Failed to parse XML: not well-formed'],
70 'skip': 'login required',
73 def _real_extract(self, url):
74 video_id = self._match_id(url)
75 webpage = self._download_webpage(url, video_id)
77 param_url = traverse_obj(
78 self._search_regex(
79 r'<iframe[^>]+data-src\s*?=\s*?([\'"])(?P<url>https://germanupa\.de/media/oembed\?url=(?:(?!\1).)+)\1',
80 webpage, 'embedded video', default=None, group='url'),
81 ({parse_qs}, 'url', 0, {url_or_none}))
83 if not param_url:
84 if self._search_regex(
85 r'<div[^>]+class\s*?=\s*?([\'"])(?:(?!\1).)*login-wrapper(?:(?!\1).)*\1',
86 webpage, 'login wrapper', default=None):
87 self.raise_login_required('This video is only available for members')
88 return self.url_result(url, 'Generic') # Fall back to generic to extract audio
90 real_url = param_url.replace('https://vimeo.com/', 'https://player.vimeo.com/video/')
91 return self.url_result(VimeoIE._smuggle_referrer(real_url, url), VimeoIE, video_id)