]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/bet.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / bet.py
1 from .mtv import MTVServicesInfoExtractor
2 from ..utils import unified_strdate
3
4
5 class BetIE(MTVServicesInfoExtractor):
6 _WORKING = False
7 _VALID_URL = r'https?://(?:www\.)?bet\.com/(?:[^/]+/)+(?P<id>.+?)\.html'
8 _TESTS = [
9 {
10 'url': 'http://www.bet.com/news/politics/2014/12/08/in-bet-exclusive-obama-talks-race-and-racism.html',
11 'info_dict': {
12 'id': '07e96bd3-8850-3051-b856-271b457f0ab8',
13 'display_id': 'in-bet-exclusive-obama-talks-race-and-racism',
14 'ext': 'flv',
15 'title': 'A Conversation With President Obama',
16 'description': 'President Obama urges persistence in confronting racism and bias.',
17 'duration': 1534,
18 'upload_date': '20141208',
19 'thumbnail': r're:(?i)^https?://.*\.jpg$',
20 'subtitles': {
21 'en': 'mincount:2',
22 },
23 },
24 'params': {
25 # rtmp download
26 'skip_download': True,
27 },
28 },
29 {
30 'url': 'http://www.bet.com/video/news/national/2014/justice-for-ferguson-a-community-reacts.html',
31 'info_dict': {
32 'id': '9f516bf1-7543-39c4-8076-dd441b459ba9',
33 'display_id': 'justice-for-ferguson-a-community-reacts',
34 'ext': 'flv',
35 'title': 'Justice for Ferguson: A Community Reacts',
36 'description': 'A BET News special.',
37 'duration': 1696,
38 'upload_date': '20141125',
39 'thumbnail': r're:(?i)^https?://.*\.jpg$',
40 'subtitles': {
41 'en': 'mincount:2',
42 },
43 },
44 'params': {
45 # rtmp download
46 'skip_download': True,
47 },
48 },
49 ]
50
51 _FEED_URL = 'http://feeds.mtvnservices.com/od/feed/bet-mrss-player'
52
53 def _get_feed_query(self, uri):
54 return {
55 'uuid': uri,
56 }
57
58 def _extract_mgid(self, webpage):
59 return self._search_regex(r'data-uri="([^"]+)', webpage, 'mgid')
60
61 def _real_extract(self, url):
62 display_id = self._match_id(url)
63
64 webpage = self._download_webpage(url, display_id)
65 mgid = self._extract_mgid(webpage)
66 videos_info = self._get_videos_info(mgid)
67
68 info_dict = videos_info['entries'][0]
69
70 upload_date = unified_strdate(self._html_search_meta('date', webpage))
71 description = self._html_search_meta('description', webpage)
72
73 info_dict.update({
74 'display_id': display_id,
75 'description': description,
76 'upload_date': upload_date,
77 })
78
79 return info_dict