]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/njpwworld.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urlparse
14 class NJPWWorldIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://njpwworld\.com/p/(?P<id>[a-z0-9_]+)'
16 IE_DESC
= '新日本プロレスワールド'
17 _NETRC_MACHINE
= 'njpwworld'
20 'url': 'http://njpwworld.com/p/s_series_00155_1_9/',
22 'id': 's_series_00155_1_9',
24 'title': '第9試合 ランディ・サベージ vs リック・スタイナー',
28 'skip_download': True, # AES-encrypted m3u8
30 'skip': 'Requires login',
33 def _real_initialize(self
):
37 username
, password
= self
._get
_login
_info
()
38 # No authentication to be performed
42 webpage
, urlh
= self
._download
_webpage
_handle
(
43 'https://njpwworld.com/auth/login', None,
44 note
='Logging in', errnote
='Unable to login',
45 data
=urlencode_postdata({'login_id': username
, 'pw': password
}))
46 # /auth/login will return 302 for successful logins
47 if urlh
.geturl() == 'https://njpwworld.com/auth/login':
48 self
.report_warning('unable to login')
53 def _real_extract(self
, url
):
54 video_id
= self
._match
_id
(url
)
56 webpage
= self
._download
_webpage
(url
, video_id
)
59 for player_url
, kind
in re
.findall(r
'<a[^>]+href="(/player[^"]+)".+?<img[^>]+src="[^"]+qf_btn_([^".]+)', webpage
):
60 player_url
= compat_urlparse
.urljoin(url
, player_url
)
62 player_page
= self
._download
_webpage
(
63 player_url
, video_id
, note
='Downloading player page')
65 entries
= self
._parse
_html
5_media
_entries
(
66 player_url
, player_page
, video_id
, m3u8_id
='hls-%s' % kind
,
67 m3u8_entry_protocol
='m3u8_native',
68 preference
=2 if 'hq' in kind
else 1)
69 formats
.extend(entries
[0]['formats'])
71 self
._sort
_formats
(formats
)
73 post_content
= get_element_by_class('post-content', webpage
)
75 r
'<li[^>]+class="tag-[^"]+"><a[^>]*>([^<]+)</a></li>', post_content
76 ) if post_content
else None
80 'title': self
._og
_search
_title
(webpage
),