]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/funker530.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / funker530.py
1 from .common import InfoExtractor
2 from .rumble import RumbleEmbedIE
3 from .youtube import YoutubeIE
4 from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none
5
6
7 class Funker530IE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)'
9 _TESTS = [{
10 'url': 'https://funker530.com/video/azov-patrol-caught-in-open-under-automatic-grenade-launcher-fire/',
11 'md5': '085f50fea27523a388bbc22e123e09c8',
12 'info_dict': {
13 'id': 'v2qbmu4',
14 'ext': 'mp4',
15 'title': 'Azov Patrol Caught In Open Under Automatic Grenade Launcher Fire',
16 'thumbnail': r're:^https?://.*\.jpg$',
17 'uploader': 'Funker530',
18 'channel': 'Funker530',
19 'channel_url': 'https://rumble.com/c/c-1199543',
20 'width': 1280,
21 'height': 720,
22 'fps': 25,
23 'duration': 27,
24 'upload_date': '20230608',
25 'timestamp': 1686241321,
26 'live_status': 'not_live',
27 'description': 'md5:bea2e1f458095414e04b5ac189c2f980',
28 },
29 }, {
30 'url': 'https://funker530.com/video/my-friends-joined-the-russians-civdiv/',
31 'md5': 'a42c2933391210662e93e867d7124b70',
32 'info_dict': {
33 'id': 'k-pk4bOvoac',
34 'ext': 'mp4',
35 'view_count': int,
36 'channel': 'Civ Div',
37 'comment_count': int,
38 'channel_follower_count': int,
39 'thumbnail': 'https://i.ytimg.com/vi/k-pk4bOvoac/maxresdefault.jpg',
40 'uploader_id': '@CivDiv',
41 'duration': 357,
42 'channel_url': 'https://www.youtube.com/channel/UCgsCiwJ88up-YyMHo7hL5-A',
43 'tags': [],
44 'uploader_url': 'https://www.youtube.com/@CivDiv',
45 'channel_id': 'UCgsCiwJ88up-YyMHo7hL5-A',
46 'like_count': int,
47 'description': 'md5:aef75ec3f59c07a0e39400f609b24429',
48 'live_status': 'not_live',
49 'age_limit': 0,
50 'uploader': 'Civ Div',
51 'categories': ['People & Blogs'],
52 'title': 'My “Friends” joined the Russians.',
53 'availability': 'public',
54 'upload_date': '20230608',
55 'playable_in_embed': True,
56 'heatmap': 'count:100',
57 },
58 }]
59
60 def _real_extract(self, url):
61 display_id = self._match_id(url)
62 webpage = self._download_webpage(url, display_id)
63 info = {}
64 rumble_url = list(RumbleEmbedIE._extract_embed_urls(url, webpage))
65 if rumble_url:
66 info = {'url': rumble_url[0], 'ie_key': RumbleEmbedIE.ie_key()}
67 else:
68 youtube_url = list(YoutubeIE._extract_embed_urls(url, webpage))
69 if youtube_url:
70 info = {'url': youtube_url[0], 'ie_key': YoutubeIE.ie_key()}
71 if not info:
72 raise ExtractorError('No videos found on webpage', expected=True)
73
74 return {
75 **info,
76 '_type': 'url_transparent',
77 'description': strip_or_none(self._search_regex(
78 r'(?s)(.+)About the Author', clean_html(get_element_by_class('video-desc-paragraph', webpage)),
79 'description', default=None)),
80 }