3 from .common
import InfoExtractor
4 from ..compat
import compat_urlparse
11 class NJPWWorldIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(front\.)?njpwworld\.com/p/(?P<id>[a-z0-9_]+)'
13 IE_DESC
= '新日本プロレスワールド'
14 _NETRC_MACHINE
= 'njpwworld'
17 'url': 'http://njpwworld.com/p/s_series_00155_1_9/',
19 'id': 's_series_00155_1_9',
21 'title': '闘強導夢2000 2000年1月4日 東京ドーム 第9試合 ランディ・サベージ VS リック・スタイナー',
25 'skip_download': True, # AES-encrypted m3u8
27 'skip': 'Requires login',
29 'url': 'https://front.njpwworld.com/p/s_series_00563_16_bs',
31 'id': 's_series_00563_16_bs',
33 'title': 'WORLD TAG LEAGUE 2020 & BEST OF THE SUPER Jr.27 2020年12月6日 福岡・福岡国際センター バックステージコメント(字幕あり)',
34 'tags': ["福岡・福岡国際センター", "バックステージコメント", "2020", "20年代"],
37 'skip_download': True,
41 _LOGIN_URL
= 'https://front.njpwworld.com/auth/login'
43 def _perform_login(self
, username
, password
):
44 # Setup session (will set necessary cookies)
45 self
._request
_webpage
(
46 'https://njpwworld.com/', None, note
='Setting up session')
48 webpage
, urlh
= self
._download
_webpage
_handle
(
49 self
._LOGIN
_URL
, None,
50 note
='Logging in', errnote
='Unable to login',
51 data
=urlencode_postdata({'login_id': username, 'pw': password}
),
52 headers
={'Referer': 'https://front.njpwworld.com/auth'}
)
53 # /auth/login will return 302 for successful logins
54 if urlh
.geturl() == self
._LOGIN
_URL
:
55 self
.report_warning('unable to login')
60 def _real_extract(self
, url
):
61 video_id
= self
._match
_id
(url
)
63 webpage
= self
._download
_webpage
(url
, video_id
)
66 for kind
, vid
in re
.findall(r
'if\s+\(\s*imageQualityType\s*==\s*\'([^
\']+)\'\s
*\
)\s
*{\s
*video_id\s
*=\s
*"(\d+)"', webpage):
67 player_path = '/intent?
id=%s&type=url
' % vid
68 player_url = compat_urlparse.urljoin(url, player_path)
69 formats += self._extract_m3u8_formats(
70 player_url, video_id, 'mp4
', 'm3u8_native
', m3u8_id=kind, fatal=False, quality=int(kind == 'high
'))
72 self._sort_formats(formats)
74 tag_block = get_element_by_class('tag
-block
', webpage)
76 r'<a
[^
>]+class="tag-[^"]+"[^>]*>([^<]+)</a>', tag_block
77 ) if tag_block else None
81 'title': get_element_by_class('article-title', webpage) or self._og_search_title(webpage),