mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-21 09:41:50 +00:00
[snotr] Fix extraction (closes #10338)
This commit is contained in:
parent
70852b47ca
commit
19f35402c5
2 changed files with 22 additions and 17 deletions
|
@ -7,6 +7,7 @@ Core
|
||||||
* Fix js_to_json(): correct octal or hexadecimal number detection
|
* Fix js_to_json(): correct octal or hexadecimal number detection
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
|
* [snotr] Fix extraction (#10338)
|
||||||
* [n-tv.de] Fix extraction (#10331)
|
* [n-tv.de] Fix extraction (#10331)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
float_or_none,
|
|
||||||
str_to_int,
|
|
||||||
parse_duration,
|
parse_duration,
|
||||||
|
parse_filesize,
|
||||||
|
str_to_int,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,21 +17,24 @@ class SnotrIE(InfoExtractor):
|
||||||
'url': 'http://www.snotr.com/video/13708/Drone_flying_through_fireworks',
|
'url': 'http://www.snotr.com/video/13708/Drone_flying_through_fireworks',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '13708',
|
'id': '13708',
|
||||||
'ext': 'flv',
|
'ext': 'mp4',
|
||||||
'title': 'Drone flying through fireworks!',
|
'title': 'Drone flying through fireworks!',
|
||||||
'duration': 247,
|
'duration': 248,
|
||||||
'filesize_approx': 98566144,
|
'filesize_approx': 40700000,
|
||||||
'description': 'A drone flying through Fourth of July Fireworks',
|
'description': 'A drone flying through Fourth of July Fireworks',
|
||||||
}
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
},
|
||||||
|
'expected_warnings': ['description'],
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.snotr.com/video/530/David_Letteman_-_George_W_Bush_Top_10',
|
'url': 'http://www.snotr.com/video/530/David_Letteman_-_George_W_Bush_Top_10',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '530',
|
'id': '530',
|
||||||
'ext': 'flv',
|
'ext': 'mp4',
|
||||||
'title': 'David Letteman - George W. Bush Top 10',
|
'title': 'David Letteman - George W. Bush Top 10',
|
||||||
'duration': 126,
|
'duration': 126,
|
||||||
'filesize_approx': 8912896,
|
'filesize_approx': 8500000,
|
||||||
'description': 'The top 10 George W. Bush moments, brought to you by David Letterman!',
|
'description': 'The top 10 George W. Bush moments, brought to you by David Letterman!',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@ -43,26 +46,27 @@ class SnotrIE(InfoExtractor):
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
|
|
||||||
description = self._og_search_description(webpage)
|
description = self._og_search_description(webpage)
|
||||||
video_url = 'http://cdn.videos.snotr.com/%s.flv' % video_id
|
info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0]
|
||||||
|
|
||||||
view_count = str_to_int(self._html_search_regex(
|
view_count = str_to_int(self._html_search_regex(
|
||||||
r'<p>\n<strong>Views:</strong>\n([\d,\.]+)</p>',
|
r'<p[^>]*>\s*<strong[^>]*>Views:</strong>\s*<span[^>]*>([\d,\.]+)',
|
||||||
webpage, 'view count', fatal=False))
|
webpage, 'view count', fatal=False))
|
||||||
|
|
||||||
duration = parse_duration(self._html_search_regex(
|
duration = parse_duration(self._html_search_regex(
|
||||||
r'<p>\n<strong>Length:</strong>\n\s*([0-9:]+).*?</p>',
|
r'<p[^>]*>\s*<strong[^>]*>Length:</strong>\s*<span[^>]*>([\d:]+)',
|
||||||
webpage, 'duration', fatal=False))
|
webpage, 'duration', fatal=False))
|
||||||
|
|
||||||
filesize_approx = float_or_none(self._html_search_regex(
|
filesize_approx = parse_filesize(self._html_search_regex(
|
||||||
r'<p>\n<strong>Filesize:</strong>\n\s*([0-9.]+)\s*megabyte</p>',
|
r'<p[^>]*>\s*<strong[^>]*>Filesize:</strong>\s*<span[^>]*>([^<]+)',
|
||||||
webpage, 'filesize', fatal=False), invscale=1024 * 1024)
|
webpage, 'filesize', fatal=False))
|
||||||
|
|
||||||
return {
|
info_dict.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'description': description,
|
'description': description,
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': video_url,
|
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'filesize_approx': filesize_approx,
|
'filesize_approx': filesize_approx,
|
||||||
}
|
})
|
||||||
|
|
||||||
|
return info_dict
|
||||||
|
|
Loading…
Reference in a new issue