]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/seeker.py
[compat, networking] Deprecate old functions (#2861)
[yt-dlp.git] / yt_dlp / extractor / seeker.py
CommitLineData
4a684895
RA
1import re
2
3from .common import InfoExtractor
8fbf5d2f
RA
4from ..utils import (
5 get_element_by_class,
6 strip_or_none,
7)
4a684895
RA
8
9
10class SeekerIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?seeker\.com/(?P<display_id>.*)-(?P<article_id>\d+)\.html'
12 _TESTS = [{
4a684895 13 'url': 'http://www.seeker.com/should-trump-be-required-to-release-his-tax-returns-1833805621.html',
8fbf5d2f 14 'md5': '897d44bbe0d8986a2ead96de565a92db',
4a684895 15 'info_dict': {
8fbf5d2f
RA
16 'id': 'Elrn3gnY',
17 'ext': 'mp4',
4a684895 18 'title': 'Should Trump Be Required To Release His Tax Returns?',
8fbf5d2f
RA
19 'description': 'md5:41efa8cfa8d627841045eec7b018eb45',
20 'timestamp': 1490090165,
21 'upload_date': '20170321',
4a684895
RA
22 }
23 }, {
24 'url': 'http://www.seeker.com/changes-expected-at-zoos-following-recent-gorilla-lion-shootings-1834116536.html',
25 'playlist': [
26 {
8fbf5d2f 27 'md5': '0497b9f20495174be73ae136949707d2',
4a684895 28 'info_dict': {
8fbf5d2f 29 'id': 'FihYQ8AE',
4a684895
RA
30 'ext': 'mp4',
31 'title': 'The Pros & Cons Of Zoos',
8fbf5d2f
RA
32 'description': 'md5:d88f99a8ea8e7d25e6ff77f271b1271c',
33 'timestamp': 1490039133,
34 'upload_date': '20170320',
4a684895
RA
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):
5ad28e7f 46 display_id, article_id = self._match_valid_url(url).groups()
4a684895 47 webpage = self._download_webpage(url, display_id)
8fbf5d2f
RA
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))