[cleanup] Make more playlist entries lazy (#11763)
[yt-dlp.git] / yt_dlp / extractor / theintercept.py
blobdcdca8f811dbbcffcfe2dbc4edea93b7d1aea556
1 from .common import InfoExtractor
2 from ..utils import (
3 ExtractorError,
4 int_or_none,
5 parse_iso8601,
9 class TheInterceptIE(InfoExtractor):
10 _VALID_URL = r'https?://theintercept\.com/fieldofvision/(?P<id>[^/?#]+)'
11 _TESTS = [{
12 'url': 'https://theintercept.com/fieldofvision/thisisacoup-episode-four-surrender-or-die/',
13 'md5': '145f28b41d44aab2f87c0a4ac8ec95bd',
14 'info_dict': {
15 'id': '46214',
16 'ext': 'mp4',
17 'title': '#ThisIsACoup – Episode Four: Surrender or Die',
18 'description': 'md5:74dd27f0e2fbd50817829f97eaa33140',
19 'timestamp': 1450429239,
20 'upload_date': '20151218',
21 'comment_count': int,
25 def _real_extract(self, url):
26 display_id = self._match_id(url)
27 webpage = self._download_webpage(url, display_id)
29 json_data = self._parse_json(self._search_regex(
30 r'initialStoreTree\s*=\s*(?P<json_data>{.+})', webpage,
31 'initialStoreTree'), display_id)
33 for post in json_data['resources']['posts'].values():
34 if post['slug'] == display_id:
35 return {
36 '_type': 'url_transparent',
37 'url': 'jwplatform:{}'.format(post['fov_videoid']),
38 'id': str(post['ID']),
39 'display_id': display_id,
40 'title': post['title'],
41 'description': post.get('excerpt'),
42 'timestamp': parse_iso8601(post.get('date')),
43 'comment_count': int_or_none(post.get('comments_number')),
45 raise ExtractorError('Unable to find the current post')