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