[Newgrounds] Fix description (#1562)

Authored by: u-spec-png
This commit is contained in:
u-spec-png 2021-11-05 22:12:16 +00:00 committed by GitHub
parent b515b37cc4
commit 2c5e8a961e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,9 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
clean_html,
extract_attributes, extract_attributes,
get_element_by_id,
int_or_none, int_or_none,
parse_count, parse_count,
parse_duration, parse_duration,
@ -29,7 +31,8 @@ class NewgroundsIE(InfoExtractor):
'timestamp': 1378878540, 'timestamp': 1378878540,
'upload_date': '20130911', 'upload_date': '20130911',
'duration': 143, 'duration': 143,
'description': 'md5:6d885138814015dfd656c2ddb00dacfc', 'view_count': int,
'description': 'md5:b8b3c2958875189f07d8e313462e8c4f',
}, },
}, { }, {
'url': 'https://www.newgrounds.com/portal/view/1', 'url': 'https://www.newgrounds.com/portal/view/1',
@ -41,6 +44,7 @@ class NewgroundsIE(InfoExtractor):
'uploader': 'Brian-Beaton', 'uploader': 'Brian-Beaton',
'timestamp': 955064100, 'timestamp': 955064100,
'upload_date': '20000406', 'upload_date': '20000406',
'view_count': int,
'description': 'Scrotum plays "catch."', 'description': 'Scrotum plays "catch."',
'age_limit': 17, 'age_limit': 17,
}, },
@ -54,7 +58,8 @@ class NewgroundsIE(InfoExtractor):
'uploader': 'ZONE-SAMA', 'uploader': 'ZONE-SAMA',
'timestamp': 1487965140, 'timestamp': 1487965140,
'upload_date': '20170224', 'upload_date': '20170224',
'description': 'ZTV News Episode 8 (February 2017)', 'view_count': int,
'description': 'md5:aff9b330ec2e78ed93b1ad6d017accc6',
'age_limit': 17, 'age_limit': 17,
}, },
'params': { 'params': {
@ -70,7 +75,8 @@ class NewgroundsIE(InfoExtractor):
'uploader': 'Egoraptor', 'uploader': 'Egoraptor',
'timestamp': 1140663240, 'timestamp': 1140663240,
'upload_date': '20060223', 'upload_date': '20060223',
'description': 'Metal Gear is awesome is so is this movie.', 'view_count': int,
'description': 'md5:9246c181614e23754571995104da92e0',
'age_limit': 13, 'age_limit': 13,
} }
}, { }, {
@ -80,7 +86,7 @@ class NewgroundsIE(InfoExtractor):
'id': '297383', 'id': '297383',
'ext': 'swf', 'ext': 'swf',
'title': 'Metal Gear Awesome', 'title': 'Metal Gear Awesome',
'description': 'Metal Gear is awesome is so is this movie.', 'description': 'Metal Gear Awesome',
'uploader': 'Egoraptor', 'uploader': 'Egoraptor',
'upload_date': '20060223', 'upload_date': '20060223',
'timestamp': 1140663240, 'timestamp': 1140663240,
@ -145,10 +151,13 @@ def _real_extract(self, url):
(r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+</dd>\s*<dd>[^<]+)', (r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+</dd>\s*<dd>[^<]+)',
r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+)'), webpage, 'timestamp', r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+)'), webpage, 'timestamp',
default=None)) default=None))
duration = parse_duration(self._html_search_regex( duration = parse_duration(self._html_search_regex(
r'"duration"\s*:\s*["\']?(\d+)["\']?', webpage, r'"duration"\s*:\s*["\']?(\d+)["\']?', webpage,
'duration', default=None)) 'duration', default=None))
description = clean_html(get_element_by_id('author_comments', webpage)) or self._og_search_description(webpage)
view_count = parse_count(self._html_search_regex( view_count = parse_count(self._html_search_regex(
r'(?s)<dt>\s*(?:Views|Listens)\s*</dt>\s*<dd>([\d\.,]+)</dd>', webpage, r'(?s)<dt>\s*(?:Views|Listens)\s*</dt>\s*<dd>([\d\.,]+)</dd>', webpage,
'view count', default=None)) 'view count', default=None))
@ -177,7 +186,7 @@ def _real_extract(self, url):
'duration': duration, 'duration': duration,
'formats': formats, 'formats': formats,
'thumbnail': self._og_search_thumbnail(webpage), 'thumbnail': self._og_search_thumbnail(webpage),
'description': self._og_search_description(webpage), 'description': description,
'age_limit': age_limit, 'age_limit': age_limit,
'view_count': view_count, 'view_count': view_count,
} }