]>
 
 
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/everyonesmixtape.py 
 
 
 
 
 
 
 
 
   1  from  __future__ 
import  unicode_literals
 
   5  from  . common 
import  InfoExtractor
 
  12  class  EveryonesMixtapeIE ( InfoExtractor
):  
  13      _VALID_URL 
=  r
'https?://(?:www\.)?everyonesmixtape\.com/#/mix/(?P<id>[0-9a-zA-Z]+)(?:/(?P<songnr>[0-9]))?$'  
  16          'url' :  'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi/5' ,  
  17          'file' :  '5bfseWNmlds.mp4' ,  
  19              "title" :  "Passion Pit -  \" Sleepyhead \"  (Official Music Video)" ,  
  21              "uploader_id" :  "frenchkissrecords" ,  
  22              "description" :  "Music video for  \" Sleepyhead \"  from Passion Pit's debut EP Chunk Of Change. \n Buy on iTunes: https://itunes.apple.com/us/album/chunk-of-change-ep/id300087641 \n\n Directed by The Wilderness. \n\n http://www.passionpitmusic.com \n http://www.frenchkissrecords.com" ,  
  23              "upload_date" :  "20081015"  
  26              'skip_download' :  True ,   # This is simply YouTube  
  30      def  _real_extract ( self
,  url
):  
  31          mobj 
=  re
. match ( self
._ VALID
_U RL
,  url
)  
  32          playlist_id 
=  mobj
. group ( 'id' )  
  34          pllist_url 
=  'http://everyonesmixtape.com/mixtape.php?a=getMixes&u=-1&linked= %s &explore='  %  playlist_id
 
  35          pllist_req 
=  compat_urllib_request
. Request ( pllist_url
)  
  36          pllist_req
. add_header ( 'X-Requested-With' ,  'XMLHttpRequest' )  
  38          playlist_list 
=  self
._ download
_ json
(  
  39              pllist_req
,  playlist_id
,  note
= 'Downloading playlist metadata' )  
  41              playlist_no 
=  next ( playlist
[ 'id' ]  
  42                                 for  playlist 
in  playlist_list
 
  43                                 if  playlist
[ 'code' ] ==  playlist_id
)  
  45              raise  ExtractorError ( 'Playlist id not found' )  
  47          pl_url 
=  'http://everyonesmixtape.com/mixtape.php?a=getMix&id= %s &userId=null&code='  %  playlist_no
 
  48          pl_req 
=  compat_urllib_request
. Request ( pl_url
)  
  49          pl_req
. add_header ( 'X-Requested-With' ,  'XMLHttpRequest' )  
  50          playlist 
=  self
._ download
_ json
(  
  51              pl_req
,  playlist_id
,  note
= 'Downloading playlist info' )  
  57          }  for  t 
in  playlist
[ 'tracks' ]]  
  59          if  mobj
. group ( 'songnr' ):  
  60              songnr 
=  int ( mobj
. group ( 'songnr' )) -  1  
  61              return  entries
[ songnr
]  
  63          playlist_title 
=  playlist
[ 'mixData' ][ 'name' ]  
  67              'title' :  playlist_title
,