Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
ytdl-patched
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lesmiscore
ytdl-patched
Commits
ff4d7860
Unverified
Commit
ff4d7860
authored
2 years ago
by
i6t
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[iwara] Add playlist extractors (#3639)
Authored by: i6t
parent
4f7a98c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
yt_dlp/extractor/extractors.py
+5
-1
5 additions, 1 deletion
yt_dlp/extractor/extractors.py
yt_dlp/extractor/iwara.py
+91
-4
91 additions, 4 deletions
yt_dlp/extractor/iwara.py
with
96 additions
and
5 deletions
yt_dlp/extractor/extractors.py
+
5
−
1
View file @
ff4d7860
...
...
@@ -702,7 +702,11 @@
IviCompilationIE
)
from
.ivideon
import
IvideonIE
from
.iwara
import
IwaraIE
from
.iwara
import
(
IwaraIE
,
IwaraPlaylistIE
,
IwaraUserIE
,
)
from
.izlesene
import
IzleseneIE
from
.jable
import
(
JableIE
,
...
...
This diff is collapsed.
Click to expand it.
yt_dlp/extractor/iwara.py
+
91
−
4
View file @
ff4d7860
import
re
import
urllib
from
.common
import
InfoExtractor
from
..compat
import
compat_urllib_parse_urlparse
from
..utils
import
(
int_or_none
,
mimetype2ext
,
remove_end
,
url_or_none
,
urljoin
,
unified_strdate
,
strip_or_none
,
)
class
IwaraIE
(
InfoExtractor
):
_VALID_URL
=
r
'
https?://(?:www\.|ecchi\.)?iwara\.tv/videos/(?P<id>[a-zA-Z0-9]+)
'
class
IwaraBaseIE
(
InfoExtractor
):
_BASE_REGEX
=
r
'
(?P<base_url>https?://(?:www\.|ecchi\.)?iwara\.tv)
'
def
_extract_playlist
(
self
,
base_url
,
webpage
):
for
path
in
re
.
findall
(
r
'
class=
"
title
"
>\s*<a[^<]+href=
"
([^
"
]+)
'
,
webpage
):
yield
self
.
url_result
(
urljoin
(
base_url
,
path
))
class
IwaraIE
(
IwaraBaseIE
):
_VALID_URL
=
fr
'
{
IwaraBaseIE
.
_BASE_REGEX
}
/videos/(?P<id>[a-zA-Z0-9]+)
'
_TESTS
=
[{
'
url
'
:
'
http://iwara.tv/videos/amVwUl1EHpAD9RD
'
,
# md5 is unstable
...
...
@@ -58,7 +67,7 @@ def _real_extract(self, url):
webpage
,
urlh
=
self
.
_download_webpage_handle
(
url
,
video_id
)
hostname
=
compat_
urllib
_
parse
_
urlparse
(
urlh
.
geturl
()).
hostname
hostname
=
urllib
.
parse
.
urlparse
(
urlh
.
geturl
()).
hostname
# ecchi is 'sexy' in Japanese
age_limit
=
18
if
hostname
.
split
(
'
.
'
)[
0
]
==
'
ecchi
'
else
0
...
...
@@ -118,3 +127,81 @@ def _real_extract(self, url):
'
upload_date
'
:
upload_date
,
'
description
'
:
description
,
}
class
IwaraPlaylistIE
(
IwaraBaseIE
):
_VALID_URL
=
fr
'
{
IwaraBaseIE
.
_BASE_REGEX
}
/playlist/(?P<id>[^/?#&]+)
'
IE_NAME
=
'
iwara:playlist
'
_TESTS
=
[{
'
url
'
:
'
https://ecchi.iwara.tv/playlist/best-enf
'
,
'
info_dict
'
:
{
'
title
'
:
'
Best enf
'
,
'
uploader
'
:
'
Jared98112
'
,
'
id
'
:
'
best-enf
'
,
},
'
playlist_mincount
'
:
1097
,
},
{
# urlencoded
'
url
'
:
'
https://ecchi.iwara.tv/playlist/%E3%83%97%E3%83%AC%E3%82%A4%E3%83%AA%E3%82%B9%E3%83%88-2
'
,
'
info_dict
'
:
{
'
id
'
:
'
プレイリスト-2
'
,
'
title
'
:
'
プレイリスト
'
,
'
uploader
'
:
'
mainyu
'
,
},
'
playlist_mincount
'
:
91
,
}]
def
_real_extract
(
self
,
url
):
playlist_id
,
base_url
=
self
.
_match_valid_url
(
url
).
group
(
'
id
'
,
'
base_url
'
)
playlist_id
=
urllib
.
parse
.
unquote
(
playlist_id
)
webpage
=
self
.
_download_webpage
(
url
,
playlist_id
)
return
{
'
_type
'
:
'
playlist
'
,
'
id
'
:
playlist_id
,
'
title
'
:
self
.
_html_search_regex
(
r
'
class=
"
title
"
[^>]*>([^<]+)
'
,
webpage
,
'
title
'
,
fatal
=
False
),
'
uploader
'
:
self
.
_html_search_regex
(
r
'
<h2>([^<]+)
'
,
webpage
,
'
uploader
'
,
fatal
=
False
),
'
entries
'
:
self
.
_extract_playlist
(
base_url
,
webpage
),
}
class
IwaraUserIE
(
IwaraBaseIE
):
_VALID_URL
=
fr
'
{
IwaraBaseIE
.
_BASE_REGEX
}
/users/(?P<id>[^/?#&]+)
'
IE_NAME
=
'
iwara:user
'
_TESTS
=
[{
'
url
'
:
'
https://ecchi.iwara.tv/users/CuteMMD
'
,
'
info_dict
'
:
{
'
id
'
:
'
CuteMMD
'
,
},
'
playlist_mincount
'
:
198
,
},
{
# urlencoded
'
url
'
:
'
https://ecchi.iwara.tv/users/%E5%92%95%E5%98%BF%E5%98%BF
'
,
'
info_dict
'
:
{
'
id
'
:
'
咕嘿嘿
'
,
},
'
playlist_mincount
'
:
141
,
}]
def
_entries
(
self
,
playlist_id
,
base_url
,
webpage
):
yield
from
self
.
_extract_playlist
(
base_url
,
webpage
)
page_urls
=
re
.
findall
(
r
'
class=
"
pager-item
"
[^>]*>\s*<a[^<]+href=
"
([^
"
]+)
'
,
webpage
)
for
n
,
path
in
enumerate
(
page_urls
,
2
):
yield
from
self
.
_extract_playlist
(
base_url
,
self
.
_download_webpage
(
urljoin
(
base_url
,
path
),
playlist_id
,
note
=
f
'
Downloading playlist page
{
n
}
'
))
def
_real_extract
(
self
,
url
):
playlist_id
,
base_url
=
self
.
_match_valid_url
(
url
).
group
(
'
id
'
,
'
base_url
'
)
playlist_id
=
urllib
.
parse
.
unquote
(
playlist_id
)
webpage
=
self
.
_download_webpage
(
f
'
{
base_url
}
/users/
{
playlist_id
}
/videos
'
,
playlist_id
)
return
self
.
playlist_result
(
self
.
_entries
(
playlist_id
,
base_url
,
webpage
),
playlist_id
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment