]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/aol.py 
   2  from  __future__ 
import  unicode_literals
   6  from  . common 
import  InfoExtractor
  14  class  AolIE ( InfoExtractor
):   15      IE_NAME 
=  'on.aol.com'   16      _VALID_URL 
=  r
'(?:aol-video:|https?://(?:(?:www|on)\.)?aol\.com/(?:[^/]+/)*(?:[^/?#&]+-)?)(?P<id>[^/?#&]+)'   20          'url' :  'http://on.aol.com/video/u-s--official-warns-of-largest-ever-irs-phone-scam-518167793?icid=OnHomepageC2Wide_MustSee_Img' ,   21          'md5' :  '18ef68f48740e86ae94b98da815eec42' ,   25              'title' :  'U.S. Official Warns Of  \' Largest Ever \'  IRS Phone Scam' ,   26              'description' :  'A major phone scam has cost thousands of taxpayers more than $1 million, with less than a month until income tax returns are due to the IRS.' ,   27              'timestamp' :  1395405060 ,   28              'upload_date' :  '20140321' ,   29              'uploader' :  'Newsy Studio' ,   33              'skip_download' :  True ,   36          # video with vidible ID   37          'url' :  'http://www.aol.com/video/view/netflix-is-raising-rates/5707d6b8e4b090497b04f706/' ,   39              'id' :  '5707d6b8e4b090497b04f706' ,   41              'title' :  'Netflix is Raising Rates' ,   42              'description' :  'Netflix is rewarding millions of it’s long-standing members with an increase in cost. Veuer’s Carly Figueroa has more.' ,   43              'upload_date' :  '20160408' ,   44              'timestamp' :  1460123280 ,   49              'skip_download' :  True ,   52          'url' :  'http://on.aol.com/partners/abc-551438d309eab105804dbfe8/sneak-peek-was-haley-really-framed-570eaebee4b0448640a5c944' ,   53          'only_matching' :  True ,   55          'url' :  'http://on.aol.com/shows/park-bench-shw518173474-559a1b9be4b0c3bfad3357a7?context=SH:SHW518173474:PL4327:1460619712763' ,   56          'only_matching' :  True ,   58          'url' :  'http://on.aol.com/video/519442220' ,   59          'only_matching' :  True ,   61          'url' :  'aol-video:5707d6b8e4b090497b04f706' ,   62          'only_matching' :  True ,   65      def  _real_extract ( self
,  url
):   66          video_id 
=  self
._ match
_ id
( url
)   68          response 
=  self
._ download
_ json
(   69              'https://feedapi.b2c.on.aol.com/v1.0/app/videos/aolon/ %s /details'  %  video_id
,   71          if  response
[ 'statusText' ] !=  'Ok' :   72              raise  ExtractorError ( ' %s  said:  %s '  % ( self
. IE_NAME
,  response
[ 'statusText' ]),  expected
= True )   74          video_data 
=  response
[ 'data' ]   76          m3u8_url 
=  video_data
. get ( 'videoMasterPlaylist' )   78              formats
. extend ( self
._ extract
_ m
3u8_ formats
(   79                  m3u8_url
,  video_id
,  'mp4' ,  m3u8_id
= 'hls' ,  fatal
= False ))   80          for  rendition 
in  video_data
. get ( 'renditions' , []):   81              video_url 
=  url_or_none ( rendition
. get ( 'url' ))   84              ext 
=  rendition
. get ( 'format' )   86                  formats
. extend ( self
._ extract
_ m
3u8_ formats
(   87                      video_url
,  video_id
,  'mp4' ,  m3u8_id
= 'hls' ,  fatal
= False ))   91                      'format_id' :  rendition
. get ( 'quality' ),   93                  mobj 
=  re
. search ( r
'(\d+)x(\d+)' ,  video_url
)   96                          'width' :  int ( mobj
. group ( 1 )),   97                          'height' :  int ( mobj
. group ( 2 )),  100          self
._ sort
_ formats
( formats
, ( 'width' ,  'height' ,  'tbr' ,  'format_id' ))  104              'title' :  video_data
[ 'title' ],  105              'duration' :  int_or_none ( video_data
. get ( 'duration' )),  106              'timestamp' :  int_or_none ( video_data
. get ( 'publishDate' )),  107              'view_count' :  int_or_none ( video_data
. get ( 'views' )),  108              'description' :  video_data
. get ( 'description' ),  109              'uploader' :  video_data
. get ( 'videoOwner' ),