]>
 
 
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/comedycentral.py 
 
 
 
 
 
 
 
 
   1  from  __future__ 
import  unicode_literals
 
   3  from  . mtv 
import  MTVServicesInfoExtractor
 
   4  from  . common 
import  InfoExtractor
 
   7  class  ComedyCentralIE ( MTVServicesInfoExtractor
):  
   8      _VALID_URL 
=  r
'''(?x)https?://(?:www\.)?cc\.com/  
   9          (video-clips|episodes|cc-studios|video-collections|shows(?=/[^/]+/(?!full-episodes)))  
  11      _FEED_URL 
=  'http://comedycentral.com/feeds/mrss/'  
  14          'url' :  'http://www.cc.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother' ,  
  15          'md5' :  'c4f48e9eda1b16dd10add0744344b6d8' ,  
  17              'id' :  'cef0cbb3-e776-4bc9-b62e-8016deccb354' ,  
  19              'title' :  'CC:Stand-Up|August 18, 2013|1|0101|Uncensored - Too Good of a Mother' ,  
  20              'description' :  'After a certain point, breastfeeding becomes c**kblocking.' ,  
  21              'timestamp' :  1376798400 ,  
  22              'upload_date' :  '20130818' ,  
  25          'url' :  'http://www.cc.com/shows/the-daily-show-with-trevor-noah/interviews/6yx39d/exclusive-rand-paul-extended-interview' ,  
  26          'only_matching' :  True ,  
  30  class  ComedyCentralFullEpisodesIE ( MTVServicesInfoExtractor
):  
  31      _VALID_URL 
=  r
'''(?x)https?://(?:www\.)?cc\.com/  
  32          (?:full-episodes|shows(?=/[^/]+/full-episodes))  
  34      _FEED_URL 
=  'http://comedycentral.com/feeds/mrss/'  
  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' ,  
  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' ,  
  44          'url' :  'http://www.cc.com/shows/the-daily-show-with-trevor-noah/full-episodes' ,  
  45          'only_matching' :  True ,  
  48      def  _real_extract ( self
,  url
):  
  49          playlist_id 
=  self
._ match
_ id
( url
)  
  50          webpage 
=  self
._ download
_ webpage
( url
,  playlist_id
)  
  52          feed_json 
=  self
._ search
_ regex
( r
'var triforceManifestFeed\s*=\s*(\{.+?\});\n' ,  webpage
,  'triforce feeed' )  
  53          feed 
=  self
._ parse
_ json
( feed_json
,  playlist_id
)  
  54          zones 
=  feed
[ 'manifest' ][ 'zones' ]  
  56          video_zone 
=  zones
[ 't2_lc_promo1' ]  
  57          feed 
=  self
._ download
_ json
( video_zone
[ 'feed' ],  playlist_id
)  
  58          mgid 
=  feed
[ 'result' ][ 'data' ][ 'id' ]  
  60          videos_info 
=  self
._ get
_ videos
_ info
( mgid
)  
  64  class  ToshIE ( MTVServicesInfoExtractor
):  
  66      _VALID_URL 
=  r
'^https?://tosh\.cc\.com/video-(?:clips|collections)/[^/]+/(?P<videotitle>[^/?#]+)'  
  67      _FEED_URL 
=  'http://tosh.cc.com/feeds/mrss'  
  70          'url' :  'http://tosh.cc.com/video-clips/68g93d/twitter-users-share-summer-plans' ,  
  72              'description' :  'Tosh asked fans to share their summer plans.' ,  
  73              'title' :  'Twitter Users Share Summer Plans' ,  
  76              'md5' :  'f269e88114c1805bb6d7653fecea9e06' ,  
  78                  'id' :  '90498ec2-ed00-11e0-aca6-0026b9414f30' ,  
  80                  'title' :  'Tosh.0|June 9, 2077|2|211|Twitter Users Share Summer Plans' ,  
  81                  'description' :  'Tosh asked fans to share their summer plans.' ,  
  82                  'thumbnail' :  're:^https?://.*\.jpg' ,  
  83                  # It's really reported to be published on year 2077  
  84                  'upload_date' :  '20770610' ,  
  85                  'timestamp' :  3390510600 ,  
  92          'url' :  'http://tosh.cc.com/video-collections/x2iz7k/just-plain-foul/m5q4fp' ,  
  93          'only_matching' :  True ,  
  97      def  _transform_rtmp_url ( cls
,  rtmp_video_url
):  
  98          new_urls 
=  super ( ToshIE
,  cls
) ._ transform
_ rtmp
_u rl
( rtmp_video_url
)  
  99          new_urls
[ 'rtmp' ] =  rtmp_video_url
. replace ( 'viacomccstrm' ,  'viacommtvstrm' )  
 103  class  ComedyCentralTVIE ( MTVServicesInfoExtractor
):  
 104      _VALID_URL 
=  r
'https?://(?:www\.)?comedycentral\.tv/(?:staffeln|shows)/(?P<id>[^/?#&]+)'  
 106          'url' :  'http://www.comedycentral.tv/staffeln/7436-the-mindy-project-staffel-4' ,  
 108              'id' :  'local_playlist-f99b626bdfe13568579a' ,  
 110              'title' :  'Episode_the-mindy-project_shows_season-4_episode-3_full-episode_part1' ,  
 114              'skip_download' :  True ,  
 117          'url' :  'http://www.comedycentral.tv/shows/1074-workaholics' ,  
 118          'only_matching' :  True ,  
 120          'url' :  'http://www.comedycentral.tv/shows/1727-the-mindy-project/bonus' ,  
 121          'only_matching' :  True ,  
 124      def  _real_extract ( self
,  url
):  
 125          video_id 
=  self
._ match
_ id
( url
)  
 127          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)  
 129          mrss_url 
=  self
._ search
_ regex
(  
 130              r
'data-mrss=(["\' ])( ?P
< url
>( ?
:( ?
! \
1 ).)+) \
1 ',  
 131              webpage, ' mrss url
', group=' url
')  
 133          return self._get_videos_info_from_url(mrss_url, video_id)  
 136  class ComedyCentralShortnameIE(InfoExtractor):  
 137      _VALID_URL = r' ^
:( ?P
< id > tds|thedailyshow
) $
'  
 140          ' only_matching
': True,  
 142          ' url
': ' : thedailyshow
',  
 143          ' only_matching
': True,  
 146      def _real_extract(self, url):  
 147          video_id = self._match_id(url)  
 149              ' tds
': ' http
:// www
. cc
. com
/ shows
/ the
- daily
- show
- with - trevor
- noah
/ full
- episodes
',  
 150              ' thedailyshow
': ' http
:// www
. cc
. com
/ shows
/ the
- daily
- show
- with - trevor
- noah
/ full
- episodes
',  
 152          return self.url_result(shortcut_map[video_id])