2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..compat import compat_str
12 class AnimalPlanetIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?animalplanet\.com/([^/]+/)*(?P<id>[^/\?#]+)'
15 'url': 'http://www.animalplanet.com/tv-shows/i-shouldnt-be-alive/videos/dog-saves-injured-owner/',
19 'title': 'Dog Saves Injured Owner',
20 'description': 'A world class athlete is put to the test when she falls into a canyon and breaks her hip. Her only companion is her dog, Taz, who is on a mission to save her!',
21 'upload_date': '20100410',
22 'timestamp': 1270857727,
27 'skip_download': True,
30 'url': 'http://www.animalplanet.com/longfin-eels-maneaters/',
31 'only_matching': True,
34 def _real_extract(self, url):
35 display_id = self._match_id(url)
36 webpage = self._download_webpage(url, display_id)
38 video_data = self._parse_json(self._search_regex(
39 r'initialVideoData\s*=\s*({.+?});',
40 webpage, 'initialVideoData'), display_id)['playlist'][0]
43 'id': compat_str(video_data['id']),
44 'display_id': display_id,
45 'title': video_data['title'],
46 'description': video_data.get('description'),
47 'thumbnail': video_data.get('thumbnailURL'),
48 'duration': parse_duration(video_data.get('video_length')),
49 'timestamp': parse_iso8601(video_data.get('publishedDate')),
50 'formats': self._extract_m3u8_formats(
51 video_data['src'], display_id, 'mp4',
52 'm3u8_native', m3u8_id='hls')