Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Ralf
youtube-dl
Commits
cd85a1bb
Unverified
Commit
cd85a1bb
authored
Sep 19, 2020
by
Sergey M․
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[pornhub] Extract metadata from JSON-LD (closes #26614)
parent
ce5b9040
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
youtube_dl/extractor/pornhub.py
youtube_dl/extractor/pornhub.py
+12
-5
No files found.
youtube_dl/extractor/pornhub.py
View file @
cd85a1bb
...
...
@@ -17,6 +17,7 @@ from ..utils import (
determine_ext
,
ExtractorError
,
int_or_none
,
merge_dicts
,
NO_DEFAULT
,
orderedSet
,
remove_quotes
,
...
...
@@ -59,13 +60,14 @@ class PornHubIE(PornHubBaseIE):
'''
_TESTS
=
[{
'url'
:
'http://www.pornhub.com/view_video.php?viewkey=648719015'
,
'md5'
:
'
1e19b41231a02eba417839222ac9d58e
'
,
'md5'
:
'
a6391306d050e4547f62b3f485dd9ba9
'
,
'info_dict'
:
{
'id'
:
'648719015'
,
'ext'
:
'mp4'
,
'title'
:
'Seductive Indian beauty strips down and fingers her pink pussy'
,
'uploader'
:
'Babes'
,
'upload_date'
:
'20130628'
,
'timestamp'
:
1372447216
,
'duration'
:
361
,
'view_count'
:
int
,
'like_count'
:
int
,
...
...
@@ -82,8 +84,8 @@ class PornHubIE(PornHubBaseIE):
'id'
:
'1331683002'
,
'ext'
:
'mp4'
,
'title'
:
'重庆婷婷女王足交'
,
'uploader'
:
'Unknown'
,
'upload_date'
:
'20150213'
,
'timestamp'
:
1423804862
,
'duration'
:
1753
,
'view_count'
:
int
,
'like_count'
:
int
,
...
...
@@ -121,6 +123,7 @@ class PornHubIE(PornHubBaseIE):
'params'
:
{
'skip_download'
:
True
,
},
'skip'
:
'This video has been disabled'
,
},
{
'url'
:
'http://www.pornhub.com/view_video.php?viewkey=ph557bbb6676d2d'
,
'only_matching'
:
True
,
...
...
@@ -338,7 +341,7 @@ class PornHubIE(PornHubBaseIE):
video_uploader
=
self
.
_html_search_regex
(
r
'(?s)From: .+?<(?:a\b[^>]+\bhref=["\']/(?:(?:user|channel)s|model|pornstar)/|span\b[^>]+\bclass=["\']username)[^>]+>(.+?)<'
,
webpage
,
'uploader'
,
fatal
=
Fals
e
)
webpage
,
'uploader'
,
default
=
Non
e
)
view_count
=
self
.
_extract_count
(
r
'<span class="count">([\d,\.]+)</span> [Vv]iews'
,
webpage
,
'view'
)
...
...
@@ -356,7 +359,11 @@ class PornHubIE(PornHubBaseIE):
if
div
:
return
re
.
findall
(
r
'<a[^>]+\bhref=[^>]+>([^<]+)'
,
div
)
return
{
info
=
self
.
_search_json_ld
(
webpage
,
video_id
,
default
=
{})
# description provided in JSON-LD is irrelevant
info
[
'description'
]
=
None
return
merge_dicts
({
'id'
:
video_id
,
'uploader'
:
video_uploader
,
'upload_date'
:
upload_date
,
...
...
@@ -372,7 +379,7 @@ class PornHubIE(PornHubBaseIE):
'tags'
:
extract_list
(
'tags'
),
'categories'
:
extract_list
(
'categories'
),
'subtitles'
:
subtitles
,
}
}
,
info
)
class
PornHubPlaylistBaseIE
(
PornHubBaseIE
):
...
...
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