]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telegraaf.py
Imported Upstream version 2015.11.27.1
[youtubedl] / youtube_dl / extractor / telegraaf.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import remove_end
6
7
8 class TelegraafIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?telegraaf\.nl/tv/(?:[^/]+/)+(?P<id>\d+)/[^/]+\.html'
10 _TEST = {
11 'url': 'http://www.telegraaf.nl/tv/nieuws/binnenland/24353229/__Tikibad_ontruimd_wegens_brand__.html',
12 'md5': '83245a9779bcc4a24454bfd53c65b6dc',
13 'info_dict': {
14 'id': '24353229',
15 'ext': 'mp4',
16 'title': 'Tikibad ontruimd wegens brand',
17 'description': 'md5:05ca046ff47b931f9b04855015e163a4',
18 'thumbnail': 're:^https?://.*\.jpg$',
19 'duration': 33,
20 },
21 }
22
23 def _real_extract(self, url):
24 playlist_id = self._match_id(url)
25
26 webpage = self._download_webpage(url, playlist_id)
27
28 playlist_url = self._search_regex(
29 r"iframe\.loadPlayer\('([^']+)'", webpage, 'player')
30
31 entries = self._extract_xspf_playlist(playlist_url, playlist_id)
32 title = remove_end(self._og_search_title(webpage), ' - VIDEO')
33 description = self._og_search_description(webpage)
34
35 return self.playlist_result(entries, playlist_id, title, description)