]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/bild.py
Update README.md
[youtubedl] / youtube_dl / extractor / bild.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import (
6 int_or_none,
7 unescapeHTML,
8 )
9
10
11 class BildIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?bild\.de/(?:[^/]+/)+(?P<display_id>[^/]+)-(?P<id>\d+)(?:,auto=true)?\.bild\.html'
13 IE_DESC = 'Bild.de'
14 _TEST = {
15 'url': 'http://www.bild.de/video/clip/apple-ipad-air/das-koennen-die-neuen-ipads-38184146.bild.html',
16 'md5': 'dd495cbd99f2413502a1713a1156ac8a',
17 'info_dict': {
18 'id': '38184146',
19 'ext': 'mp4',
20 'title': 'Das können die neuen iPads',
21 'description': 'md5:a4058c4fa2a804ab59c00d7244bbf62f',
22 'thumbnail': r're:^https?://.*\.jpg$',
23 'duration': 196,
24 }
25 }
26
27 def _real_extract(self, url):
28 video_id = self._match_id(url)
29
30 video_data = self._download_json(
31 url.split('.bild.html')[0] + ',view=json.bild.html', video_id)
32
33 return {
34 'id': video_id,
35 'title': unescapeHTML(video_data['title']).strip(),
36 'description': unescapeHTML(video_data.get('description')),
37 'url': video_data['clipList'][0]['srces'][0]['src'],
38 'thumbnail': video_data.get('poster'),
39 'duration': int_or_none(video_data.get('durationSec')),
40 }