]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/everyonesmixtape.py
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
14 class EveryonesMixtapeIE ( InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?everyonesmixtape\.com/#/mix/(?P<id>[0-9a-zA-Z]+)(?:/(?P<songnr>[0-9]))?$'
18 'url' : 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi/5' ,
22 "title" : "Passion Pit - \" Sleepyhead \" (Official Music Video)" ,
24 "uploader_id" : "frenchkissrecords" ,
25 "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" ,
26 "upload_date" : "20081015"
29 'skip_download' : True , # This is simply YouTube
32 'url' : 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi' ,
40 def _real_extract ( self
, url
):
41 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
42 playlist_id
= mobj
. group ( 'id' )
44 pllist_url
= 'http://everyonesmixtape.com/mixtape.php?a=getMixes&u=-1&linked= %s &explore=' % playlist_id
45 pllist_req
= compat_urllib_request
. Request ( pllist_url
)
46 pllist_req
. add_header ( 'X-Requested-With' , 'XMLHttpRequest' )
48 playlist_list
= self
._ download
_ json
(
49 pllist_req
, playlist_id
, note
= 'Downloading playlist metadata' )
51 playlist_no
= next ( playlist
[ 'id' ]
52 for playlist
in playlist_list
53 if playlist
[ 'code' ] == playlist_id
)
55 raise ExtractorError ( 'Playlist id not found' )
57 pl_url
= 'http://everyonesmixtape.com/mixtape.php?a=getMix&id= %s &userId=null&code=' % playlist_no
58 pl_req
= compat_urllib_request
. Request ( pl_url
)
59 pl_req
. add_header ( 'X-Requested-With' , 'XMLHttpRequest' )
60 playlist
= self
._ download
_ json
(
61 pl_req
, playlist_id
, note
= 'Downloading playlist info' )
67 } for t
in playlist
[ 'tracks' ]]
69 if mobj
. group ( 'songnr' ):
70 songnr
= int ( mobj
. group ( 'songnr' )) - 1
71 return entries
[ songnr
]
73 playlist_title
= playlist
[ 'mixData' ][ 'name' ]
77 'title' : playlist_title
,