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