Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Backups
youtube-dl
Commits
db182c63
Unverified
Commit
db182c63
authored
Feb 25, 2017
by
Yen Chi Hsuan
Browse files
[njpwworld] Add new extractor (closes #11561)
parent
eeb0a956
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
0 deletions
+90
-0
ChangeLog
ChangeLog
+6
-0
youtube_dl/extractor/extractors.py
youtube_dl/extractor/extractors.py
+1
-0
youtube_dl/extractor/njpwworld.py
youtube_dl/extractor/njpwworld.py
+83
-0
No files found.
ChangeLog
View file @
db182c63
version <unreleased>
Extractors
+ [njpwworld] Add new extractor (#11561)
version 2017.02.24.1
Extractors
...
...
youtube_dl/extractor/extractors.py
View file @
db182c63
...
...
@@ -637,6 +637,7 @@ from .ninecninemedia import (
from
.ninegag
import
NineGagIE
from
.ninenow
import
NineNowIE
from
.nintendo
import
NintendoIE
from
.njpwworld
import
NJPWWorldIE
from
.nobelprize
import
NobelPrizeIE
from
.noco
import
NocoIE
from
.normalboots
import
NormalbootsIE
...
...
youtube_dl/extractor/njpwworld.py
0 → 100644
View file @
db182c63
# coding: utf-8
from
__future__
import
unicode_literals
import
re
from
.common
import
InfoExtractor
from
..compat
import
compat_urlparse
from
..utils
import
(
get_element_by_class
,
urlencode_postdata
,
)
class
NJPWWorldIE
(
InfoExtractor
):
_VALID_URL
=
r
'https?://njpwworld\.com/p/(?P<id>[a-z0-9_]+)'
IE_DESC
=
'新日本プロレスワールド'
_NETRC_MACHINE
=
'njpwworld'
_TEST
=
{
'url'
:
'http://njpwworld.com/p/s_series_00155_1_9/'
,
'info_dict'
:
{
'id'
:
's_series_00155_1_9'
,
'ext'
:
'mp4'
,
'title'
:
'第9試合 ランディ・サベージ vs リック・スタイナー'
,
'tags'
:
list
,
},
'params'
:
{
'skip_download'
:
True
,
# AES-encrypted m3u8
},
'skip'
:
'Requires login'
,
}
def
_real_initialize
(
self
):
self
.
_login
()
def
_login
(
self
):
username
,
password
=
self
.
_get_login_info
()
# No authentication to be performed
if
not
username
:
return
True
webpage
,
urlh
=
self
.
_download_webpage_handle
(
'https://njpwworld.com/auth/login'
,
None
,
note
=
'Logging in'
,
errnote
=
'Unable to login'
,
data
=
urlencode_postdata
({
'login_id'
:
username
,
'pw'
:
password
}))
# /auth/login will return 302 for successful logins
if
urlh
.
geturl
()
==
'https://njpwworld.com/auth/login'
:
self
.
report_warning
(
'unable to login'
)
return
False
return
True
def
_real_extract
(
self
,
url
):
video_id
=
self
.
_match_id
(
url
)
webpage
=
self
.
_download_webpage
(
url
,
video_id
)
formats
=
[]
for
player_url
,
kind
in
re
.
findall
(
r
'<a[^>]+href="(/player[^"]+)".+?<img[^>]+src="[^"]+qf_btn_([^".]+)'
,
webpage
):
player_url
=
compat_urlparse
.
urljoin
(
url
,
player_url
)
player_page
=
self
.
_download_webpage
(
player_url
,
video_id
,
note
=
'Downloading player page'
)
entries
=
self
.
_parse_html5_media_entries
(
player_url
,
player_page
,
video_id
,
m3u8_id
=
'hls-%s'
%
kind
,
m3u8_entry_protocol
=
'm3u8_native'
,
preference
=
2
if
'hq'
in
kind
else
1
)
formats
.
extend
(
entries
[
0
][
'formats'
])
self
.
_sort_formats
(
formats
)
post_content
=
get_element_by_class
(
'post-content'
,
webpage
)
tags
=
re
.
findall
(
r
'<li[^>]+class="tag-[^"]+"><a[^>]*>([^<]+)</a></li>'
,
post_content
)
if
post_content
else
None
return
{
'id'
:
video_id
,
'title'
:
self
.
_og_search_title
(
webpage
),
'formats'
:
formats
,
'tags'
:
tags
,
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment