]>
Commit | Line | Data |
---|---|---|
a4a02832 PH |
1 | from __future__ import unicode_literals |
2 | ||
84db8181 | 3 | from .mtv import MTVServicesInfoExtractor |
6a9b3b61 | 4 | from .common import InfoExtractor |
ea63e499 PH |
5 | |
6 | ||
84db8181 | 7 | class ComedyCentralIE(MTVServicesInfoExtractor): |
b4c538b0 | 8 | _VALID_URL = r'''(?x)https?://(?:www\.)?cc\.com/ |
f8825548 | 9 | (video-clips|episodes|cc-studios|video-collections|shows(?=/[^/]+/(?!full-episodes))) |
efa1739b | 10 | /(?P<title>.*)''' |
a4a02832 | 11 | _FEED_URL = 'http://comedycentral.com/feeds/mrss/' |
66cfab42 | 12 | |
70232512 | 13 | _TESTS = [{ |
b4c538b0 | 14 | 'url': 'http://www.cc.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother', |
3ab34c60 | 15 | 'md5': 'c4f48e9eda1b16dd10add0744344b6d8', |
a4a02832 PH |
16 | 'info_dict': { |
17 | 'id': 'cef0cbb3-e776-4bc9-b62e-8016deccb354', | |
18 | 'ext': 'mp4', | |
cc99d4f8 | 19 | 'title': 'CC:Stand-Up|August 18, 2013|1|0101|Uncensored - Too Good of a Mother', |
a4a02832 | 20 | 'description': 'After a certain point, breastfeeding becomes c**kblocking.', |
cc99d4f8 YCH |
21 | 'timestamp': 1376798400, |
22 | 'upload_date': '20130818', | |
66cfab42 | 23 | }, |
70232512 JMF |
24 | }, { |
25 | 'url': 'http://www.cc.com/shows/the-daily-show-with-trevor-noah/interviews/6yx39d/exclusive-rand-paul-extended-interview', | |
26 | 'only_matching': True, | |
27 | }] | |
66cfab42 | 28 | |
66cfab42 | 29 | |
cc61fc39 PH |
30 | class ComedyCentralFullEpisodesIE(MTVServicesInfoExtractor): |
31 | _VALID_URL = r'''(?x)https?://(?:www\.)?cc\.com/ | |
f8825548 | 32 | (?:full-episodes|shows(?=/[^/]+/full-episodes)) |
cc61fc39 PH |
33 | /(?P<id>[^?]+)''' |
34 | _FEED_URL = 'http://comedycentral.com/feeds/mrss/' | |
35 | ||
36 | _TESTS = [{ | |
37 | 'url': 'http://www.cc.com/full-episodes/pv391a/the-daily-show-with-trevor-noah-november-28--2016---ryan-speedo-green-season-22-ep-22028', | |
38 | 'info_dict': { | |
39 | 'description': 'Donald Trump is accused of exploiting his president-elect status for personal gain, Cuban leader Fidel Castro dies, and Ryan Speedo Green discusses "Sing for Your Life."', | |
40 | 'title': 'November 28, 2016 - Ryan Speedo Green', | |
41 | }, | |
42 | 'playlist_count': 4, | |
f8825548 PH |
43 | }, { |
44 | 'url': 'http://www.cc.com/shows/the-daily-show-with-trevor-noah/full-episodes', | |
45 | 'only_matching': True, | |
cc61fc39 PH |
46 | }] |
47 | ||
48 | def _real_extract(self, url): | |
49 | playlist_id = self._match_id(url) | |
50 | webpage = self._download_webpage(url, playlist_id) | |
adf063da | 51 | mgid = self._extract_triforce_mgid(webpage, data_zone='t2_lc_promo1') |
67fc365b | 52 | videos_info = self._get_videos_info(mgid) |
cc61fc39 PH |
53 | return videos_info |
54 | ||
55 | ||
cc99d4f8 YCH |
56 | class ToshIE(MTVServicesInfoExtractor): |
57 | IE_DESC = 'Tosh.0' | |
58 | _VALID_URL = r'^https?://tosh\.cc\.com/video-(?:clips|collections)/[^/]+/(?P<videotitle>[^/?#]+)' | |
59 | _FEED_URL = 'http://tosh.cc.com/feeds/mrss' | |
60 | ||
7260ea07 | 61 | _TESTS = [{ |
cc99d4f8 | 62 | 'url': 'http://tosh.cc.com/video-clips/68g93d/twitter-users-share-summer-plans', |
91755ee3 | 63 | 'info_dict': { |
cc99d4f8 YCH |
64 | 'description': 'Tosh asked fans to share their summer plans.', |
65 | 'title': 'Twitter Users Share Summer Plans', | |
91755ee3 | 66 | }, |
cc99d4f8 YCH |
67 | 'playlist': [{ |
68 | 'md5': 'f269e88114c1805bb6d7653fecea9e06', | |
69 | 'info_dict': { | |
70 | 'id': '90498ec2-ed00-11e0-aca6-0026b9414f30', | |
71 | 'ext': 'mp4', | |
72 | 'title': 'Tosh.0|June 9, 2077|2|211|Twitter Users Share Summer Plans', | |
73 | 'description': 'Tosh asked fans to share their summer plans.', | |
ec85ded8 | 74 | 'thumbnail': r're:^https?://.*\.jpg', |
cc99d4f8 YCH |
75 | # It's really reported to be published on year 2077 |
76 | 'upload_date': '20770610', | |
77 | 'timestamp': 3390510600, | |
78 | 'subtitles': { | |
79 | 'en': 'mincount:3', | |
e41b1f73 JMF |
80 | }, |
81 | }, | |
cc99d4f8 | 82 | }] |
4c59dc4c | 83 | }, { |
cc99d4f8 | 84 | 'url': 'http://tosh.cc.com/video-collections/x2iz7k/just-plain-foul/m5q4fp', |
0150a00f | 85 | 'only_matching': True, |
7260ea07 | 86 | }] |
ea63e499 | 87 | |
45550d10 S |
88 | |
89 | class ComedyCentralTVIE(MTVServicesInfoExtractor): | |
90 | _VALID_URL = r'https?://(?:www\.)?comedycentral\.tv/(?:staffeln|shows)/(?P<id>[^/?#&]+)' | |
91 | _TESTS = [{ | |
92 | 'url': 'http://www.comedycentral.tv/staffeln/7436-the-mindy-project-staffel-4', | |
93 | 'info_dict': { | |
94 | 'id': 'local_playlist-f99b626bdfe13568579a', | |
95 | 'ext': 'flv', | |
96 | 'title': 'Episode_the-mindy-project_shows_season-4_episode-3_full-episode_part1', | |
97 | }, | |
98 | 'params': { | |
99 | # rtmp download | |
100 | 'skip_download': True, | |
101 | }, | |
102 | }, { | |
103 | 'url': 'http://www.comedycentral.tv/shows/1074-workaholics', | |
104 | 'only_matching': True, | |
105 | }, { | |
106 | 'url': 'http://www.comedycentral.tv/shows/1727-the-mindy-project/bonus', | |
107 | 'only_matching': True, | |
108 | }] | |
109 | ||
110 | def _real_extract(self, url): | |
111 | video_id = self._match_id(url) | |
112 | ||
113 | webpage = self._download_webpage(url, video_id) | |
114 | ||
115 | mrss_url = self._search_regex( | |
116 | r'data-mrss=(["\'])(?P<url>(?:(?!\1).)+)\1', | |
117 | webpage, 'mrss url', group='url') | |
118 | ||
119 | return self._get_videos_info_from_url(mrss_url, video_id) | |
6a9b3b61 PH |
120 | |
121 | ||
122 | class ComedyCentralShortnameIE(InfoExtractor): | |
123 | _VALID_URL = r'^:(?P<id>tds|thedailyshow)$' | |
124 | _TESTS = [{ | |
125 | 'url': ':tds', | |
126 | 'only_matching': True, | |
127 | }, { | |
128 | 'url': ':thedailyshow', | |
129 | 'only_matching': True, | |
130 | }] | |
131 | ||
132 | def _real_extract(self, url): | |
133 | video_id = self._match_id(url) | |
134 | shortcut_map = { | |
135 | 'tds': 'http://www.cc.com/shows/the-daily-show-with-trevor-noah/full-episodes', | |
136 | 'thedailyshow': 'http://www.cc.com/shows/the-daily-show-with-trevor-noah/full-episodes', | |
137 | } | |
138 | return self.url_result(shortcut_map[video_id]) |