mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 04:10:23 +00:00
[xhamster] Extract categories (closes #11728)
This commit is contained in:
parent
164fcbfeb7
commit
8555204274
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
clean_html,
|
||||||
dict_get,
|
dict_get,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
@ -25,6 +26,7 @@ class XHamsterIE(InfoExtractor):
|
|||||||
'uploader': 'Ruseful2011',
|
'uploader': 'Ruseful2011',
|
||||||
'duration': 893,
|
'duration': 893,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'categories': ['Fake Hub', 'Amateur', 'MILFs', 'POV', 'Boss', 'Office', 'Oral', 'Reality', 'Sexy'],
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://xhamster.com/movies/2221348/britney_spears_sexy_booty.html?hd',
|
'url': 'http://xhamster.com/movies/2221348/britney_spears_sexy_booty.html?hd',
|
||||||
@ -36,6 +38,7 @@ class XHamsterIE(InfoExtractor):
|
|||||||
'uploader': 'jojo747400',
|
'uploader': 'jojo747400',
|
||||||
'duration': 200,
|
'duration': 200,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'categories': ['Britney Spears', 'Celebrities', 'HD Videos', 'Sexy', 'Sexy Booty'],
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@ -51,6 +54,7 @@ class XHamsterIE(InfoExtractor):
|
|||||||
'uploader': 'parejafree',
|
'uploader': 'parejafree',
|
||||||
'duration': 72,
|
'duration': 72,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'categories': ['Amateur', 'Blowjobs'],
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@ -152,6 +156,12 @@ def is_hd(webpage):
|
|||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
categories_html = self._search_regex(
|
||||||
|
r'(?s)<table.+?(<span>Categories:.+?)</table>', webpage,
|
||||||
|
'categories', default=None)
|
||||||
|
categories = [clean_html(category) for category in re.findall(
|
||||||
|
r'<a[^>]+>(.+?)</a>', categories_html)] if categories_html else None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
@ -165,6 +175,7 @@ def is_hd(webpage):
|
|||||||
'dislike_count': int_or_none(dislike_count),
|
'dislike_count': int_or_none(dislike_count),
|
||||||
'comment_count': int_or_none(comment_count),
|
'comment_count': int_or_none(comment_count),
|
||||||
'age_limit': age_limit,
|
'age_limit': age_limit,
|
||||||
|
'categories': categories,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user