[youporn] Fix categories and tags extraction (Closes #10521)

This commit is contained in:
Sergey M․ 2016-09-01 23:15:01 +07:00
parent e816c9d158
commit f6af0f888b
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D
1 changed files with 9 additions and 9 deletions

View File

@ -35,7 +35,7 @@ class YouPornIE(InfoExtractor):
'age_limit': 18, 'age_limit': 18,
}, },
}, { }, {
# Anonymous User uploader # Unknown uploader
'url': 'http://www.youporn.com/watch/561726/big-tits-awesome-brunette-on-amazing-webcam-show/?from=related3&al=2&from_id=561726&pos=4', 'url': 'http://www.youporn.com/watch/561726/big-tits-awesome-brunette-on-amazing-webcam-show/?from=related3&al=2&from_id=561726&pos=4',
'info_dict': { 'info_dict': {
'id': '561726', 'id': '561726',
@ -44,7 +44,7 @@ class YouPornIE(InfoExtractor):
'title': 'Big Tits Awesome Brunette On amazing webcam show', 'title': 'Big Tits Awesome Brunette On amazing webcam show',
'description': 'http://sweetlivegirls.com Big Tits Awesome Brunette On amazing webcam show.mp4', 'description': 'http://sweetlivegirls.com Big Tits Awesome Brunette On amazing webcam show.mp4',
'thumbnail': 're:^https?://.*\.jpg$', 'thumbnail': 're:^https?://.*\.jpg$',
'uploader': 'Anonymous User', 'uploader': 'Unknown',
'upload_date': '20111125', 'upload_date': '20111125',
'average_rating': int, 'average_rating': int,
'view_count': int, 'view_count': int,
@ -140,17 +140,17 @@ class YouPornIE(InfoExtractor):
r'>All [Cc]omments? \(([\d,.]+)\)', r'>All [Cc]omments? \(([\d,.]+)\)',
webpage, 'comment count', fatal=False)) webpage, 'comment count', fatal=False))
def extract_tag_box(title): def extract_tag_box(regex, title):
tag_box = self._search_regex( tag_box = self._search_regex(regex, webpage, title, default=None)
(r'<div[^>]+class=["\']tagBoxTitle["\'][^>]*>\s*%s\b.*?</div>\s*'
'<div[^>]+class=["\']tagBoxContent["\']>(.+?)</div>') % re.escape(title),
webpage, '%s tag box' % title, default=None)
if not tag_box: if not tag_box:
return [] return []
return re.findall(r'<a[^>]+href=[^>]+>([^<]+)', tag_box) return re.findall(r'<a[^>]+href=[^>]+>([^<]+)', tag_box)
categories = extract_tag_box('Category') categories = extract_tag_box(
tags = extract_tag_box('Tags') r'(?s)Categories:.*?</[^>]+>(.+?)</div>', 'categories')
tags = extract_tag_box(
r'(?s)Tags:.*?</div>\s*<div[^>]+class=["\']tagBoxContent["\'][^>]*>(.+?)</div>',
'tags')
return { return {
'id': video_id, 'id': video_id,