]>
Commit | Line | Data |
---|---|---|
1 | import re | |
2 | ||
3 | from .common import InfoExtractor | |
4 | from ..utils import ( | |
5 | get_element_by_class, | |
6 | strip_or_none, | |
7 | ) | |
8 | ||
9 | ||
10 | class SeekerIE(InfoExtractor): | |
11 | _VALID_URL = r'https?://(?:www\.)?seeker\.com/(?P<display_id>.*)-(?P<article_id>\d+)\.html' | |
12 | _TESTS = [{ | |
13 | 'url': 'http://www.seeker.com/should-trump-be-required-to-release-his-tax-returns-1833805621.html', | |
14 | 'md5': '897d44bbe0d8986a2ead96de565a92db', | |
15 | 'info_dict': { | |
16 | 'id': 'Elrn3gnY', | |
17 | 'ext': 'mp4', | |
18 | 'title': 'Should Trump Be Required To Release His Tax Returns?', | |
19 | 'description': 'md5:41efa8cfa8d627841045eec7b018eb45', | |
20 | 'timestamp': 1490090165, | |
21 | 'upload_date': '20170321', | |
22 | } | |
23 | }, { | |
24 | 'url': 'http://www.seeker.com/changes-expected-at-zoos-following-recent-gorilla-lion-shootings-1834116536.html', | |
25 | 'playlist': [ | |
26 | { | |
27 | 'md5': '0497b9f20495174be73ae136949707d2', | |
28 | 'info_dict': { | |
29 | 'id': 'FihYQ8AE', | |
30 | 'ext': 'mp4', | |
31 | 'title': 'The Pros & Cons Of Zoos', | |
32 | 'description': 'md5:d88f99a8ea8e7d25e6ff77f271b1271c', | |
33 | 'timestamp': 1490039133, | |
34 | 'upload_date': '20170320', | |
35 | }, | |
36 | } | |
37 | ], | |
38 | 'info_dict': { | |
39 | 'id': '1834116536', | |
40 | 'title': 'After Gorilla Killing, Changes Ahead for Zoos', | |
41 | 'description': 'The largest association of zoos and others are hoping to learn from recent incidents that led to the shooting deaths of a gorilla and two lions.', | |
42 | }, | |
43 | }] | |
44 | ||
45 | def _real_extract(self, url): | |
46 | display_id, article_id = self._match_valid_url(url).groups() | |
47 | webpage = self._download_webpage(url, display_id) | |
48 | entries = [] | |
49 | for jwp_id in re.findall(r'data-video-id="([a-zA-Z0-9]{8})"', webpage): | |
50 | entries.append(self.url_result( | |
51 | 'jwplatform:' + jwp_id, 'JWPlatform', jwp_id)) | |
52 | return self.playlist_result( | |
53 | entries, article_id, | |
54 | self._og_search_title(webpage), | |
55 | strip_or_none(get_element_by_class('subtitle__text', webpage)) or self._og_search_description(webpage)) |