[vier] Relax regexes and extract more metadata (closes #12539)

This commit is contained in:
Sergey M․ 2017-05-17 23:38:27 +07:00
parent 36b226d48f
commit 650bd94716
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -27,6 +27,8 @@ class VierIE(InfoExtractor):
'title': 'Het wordt warm in De Moestuin', 'title': 'Het wordt warm in De Moestuin',
'description': 'De vele uren werk eisen hun tol. Wim droomt van assistentie...', 'description': 'De vele uren werk eisen hun tol. Wim droomt van assistentie...',
'upload_date': '20121025', 'upload_date': '20121025',
'series': 'Plan B',
'tags': ['De Moestuin', 'Moestuin', 'meisjes', 'Tomaat', 'Wim', 'Droom'],
}, },
}, { }, {
'url': 'http://www.vijf.be/temptationisland/videos/zo-grappig-temptation-island-hosts-moeten-kiezen-tussen-onmogelijke-dilemmas/2561614', 'url': 'http://www.vijf.be/temptationisland/videos/zo-grappig-temptation-island-hosts-moeten-kiezen-tussen-onmogelijke-dilemmas/2561614',
@ -37,6 +39,8 @@ class VierIE(InfoExtractor):
'title': 'md5:84f45fe48b8c1fa296a7f6d208d080a7', 'title': 'md5:84f45fe48b8c1fa296a7f6d208d080a7',
'description': 'md5:0356d4981e58b8cbee19355cbd51a8fe', 'description': 'md5:0356d4981e58b8cbee19355cbd51a8fe',
'upload_date': '20170228', 'upload_date': '20170228',
'series': 'Temptation Island',
'tags': list,
}, },
'params': { 'params': {
'skip_download': True, 'skip_download': True,
@ -50,7 +54,9 @@ class VierIE(InfoExtractor):
'title': 'Jani gaat naar Tokio - Aflevering 4', 'title': 'Jani gaat naar Tokio - Aflevering 4',
'description': 'md5:aa8d611541db6ae9e863125704511f88', 'description': 'md5:aa8d611541db6ae9e863125704511f88',
'upload_date': '20170501', 'upload_date': '20170501',
'series': 'Jani gaat',
'episode_number': 4, 'episode_number': 4,
'tags': ['Jani Gaat', 'Volledige Aflevering'],
}, },
'params': { 'params': {
'skip_download': True, 'skip_download': True,
@ -135,33 +141,36 @@ def _real_extract(self, url):
webpage, 'filename') webpage, 'filename')
playlist_url = 'http://vod.streamcloud.be/%s/_definst_/mp4:%s.mp4/playlist.m3u8' % (application, filename) playlist_url = 'http://vod.streamcloud.be/%s/_definst_/mp4:%s.mp4/playlist.m3u8' % (application, filename)
formats = self._extract_wowza_formats(playlist_url, display_id, skip_protocols=['dash']) formats = self._extract_wowza_formats(
playlist_url, display_id, skip_protocols=['dash'])
self._sort_formats(formats) self._sort_formats(formats)
title = self._og_search_title(webpage, default=display_id) title = self._og_search_title(webpage, default=display_id)
thumbnail = self._og_search_thumbnail(webpage, default=None)
description = self._html_search_regex( description = self._html_search_regex(
r'''(?x)<div\ class="[^"]*field-type-text-with-summary[^"]*">\s* r'(?s)<div\b[^>]+\bclass=(["\'])[^>]*?\bfield-type-text-with-summary\b[^>]*?\1[^>]*>.*?<p>(?P<value>.+?)</p>',
(?:<div\ class="[^"]+">\s*)* webpage, 'description', default=None, group='value')
<p>\s*(?:<span>)?(.+?)</''', thumbnail = self._og_search_thumbnail(webpage, default=None)
webpage, 'description', default=None)
episode_number = int_or_none(self._search_regex(
r'(?i)aflevering (\d+)', title, 'episode_number', default=None,
fatal=False))
upload_date = unified_strdate(self._html_search_regex( upload_date = unified_strdate(self._html_search_regex(
r'''(?x)<div\ class="[^"]*field-name-post-date[^"]*">\s* r'(?s)<div\b[^>]+\bclass=(["\'])[^>]*?\bfield-name-post-date\b[^>]*?\1[^>]*>.*?(?P<value>\d{2}/\d{2}/\d{4})',
(?:<div\ class="[^"]+">\s*)* webpage, 'upload date', default=None, group='value'))
(\d{2}/\d{2}/\d{4})''',
webpage, 'upload_date', default=None)) series = self._search_regex(
r'data-program=(["\'])(?P<value>(?:(?!\1).)+)\1', webpage,
'series', default=None, group='value')
episode_number = int_or_none(self._search_regex(
r'(?i)aflevering (\d+)', title, 'episode number', default=None))
tags = re.findall(r'<a\b[^>]+\bhref=["\']/tags/[^>]+>([^<]+)<', webpage)
return { return {
'id': video_id, 'id': video_id,
'display_id': display_id, 'display_id': display_id,
'title': title, 'title': title,
'description': description, 'description': description,
'episode_number': episode_number,
'upload_date': upload_date,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'upload_date': upload_date,
'series': series,
'episode_number': episode_number,
'tags': tags,
'formats': formats, 'formats': formats,
} }