]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/seeker.py
debian/{compat,control}: Update to debhelper compatibility level 12.
[youtubedl] / youtube_dl / extractor / seeker.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class SeekerIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?seeker\.com/(?P<display_id>.*)-(?P<article_id>\d+)\.html'
11 _TESTS = [{
12 # player.loadRevision3Item
13 'url': 'http://www.seeker.com/should-trump-be-required-to-release-his-tax-returns-1833805621.html',
14 'md5': '30c1dc4030cc715cf05b423d0947ac18',
15 'info_dict': {
16 'id': '76243',
17 'ext': 'webm',
18 'title': 'Should Trump Be Required To Release His Tax Returns?',
19 'description': 'Donald Trump has been secretive about his "big," "beautiful" tax returns. So what can we learn if he decides to release them?',
20 'uploader': 'Seeker Daily',
21 'uploader_id': 'seekerdaily',
22 }
23 }, {
24 'url': 'http://www.seeker.com/changes-expected-at-zoos-following-recent-gorilla-lion-shootings-1834116536.html',
25 'playlist': [
26 {
27 'md5': '83bcd157cab89ad7318dd7b8c9cf1306',
28 'info_dict': {
29 'id': '67558',
30 'ext': 'mp4',
31 'title': 'The Pros & Cons Of Zoos',
32 'description': 'Zoos are often depicted as a terrible place for animals to live, but is there any truth to this?',
33 'uploader': 'DNews',
34 'uploader_id': 'dnews',
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 = re.match(self._VALID_URL, url).groups()
47 webpage = self._download_webpage(url, display_id)
48 mobj = re.search(r"player\.loadRevision3Item\('([^']+)'\s*,\s*(\d+)\);", webpage)
49 if mobj:
50 playlist_type, playlist_id = mobj.groups()
51 return self.url_result(
52 'revision3:%s:%s' % (playlist_type, playlist_id), 'Revision3Embed', playlist_id)
53 else:
54 entries = [self.url_result('revision3:video_id:%s' % video_id, 'Revision3Embed', video_id) for video_id in re.findall(
55 r'<iframe[^>]+src=[\'"](?:https?:)?//api\.seekernetwork\.com/player/embed\?videoId=(\d+)', webpage)]
56 return self.playlist_result(
57 entries, article_id, self._og_search_title(webpage), self._og_search_description(webpage))