]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ufctv.py
f3eaee6b3f45b71dadb0a1d3310aa3bf9cebf073
2 from __future__
import unicode_literals
4 from . common
import InfoExtractor
13 class UFCTVIE ( InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?ufc\.tv/video/(?P<id>[^/]+)'
15 _NETRC_MACHINE
= 'ufctv'
17 'url' : 'https://www.ufc.tv/video/ufc-219-countdown-full-episode' ,
21 'title' : 'UFC 219 Countdown: Full Episode' ,
22 'description' : 'md5:26d4e8bf4665ae5878842d7050c3c646' ,
23 'timestamp' : 1513962360 ,
24 'upload_date' : '20171222' ,
28 'skip_download' : True ,
32 def _real_initialize ( self
):
33 username
, password
= self
._ get
_l ogin
_ info
()
37 code
= self
._ download
_ json
(
38 'https://www.ufc.tv/secure/authenticate' ,
39 None , 'Logging in' , data
= urlencode_postdata ({
44 if code
and code
!= 'loginsuccess' :
45 raise ExtractorError ( code
, expected
= True )
47 def _real_extract ( self
, url
):
48 display_id
= self
._ match
_ id
( url
)
49 video_data
= self
._ download
_ json
( url
, display_id
, query
={
52 video_id
= str ( video_data
[ 'id' ])
53 title
= video_data
[ 'name' ]
54 m3u8_url
= self
._ download
_ json
(
55 'https://www.ufc.tv/service/publishpoint' , video_id
, query
={
60 'User-Agent' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0_1 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A402 Safari/604.1' ,
62 m3u8_url
= m3u8_url
. replace ( '_iphone.' , '.' )
63 formats
= self
._ extract
_ m
3u8_ formats
( m3u8_url
, video_id
, 'mp4' )
64 self
._ sort
_ formats
( formats
)
69 'description' : video_data
. get ( 'description' ),
70 'duration' : parse_duration ( video_data
. get ( 'runtime' )),
71 'timestamp' : parse_iso8601 ( video_data
. get ( 'releaseDate' )),