[rh:websockets] Support websockets 14.0+ (#11616)
[yt-dlp3.git] / yt_dlp / extractor / israelnationalnews.py
blob76e54d9cf921d064b4823a1d269e208cb0b3006f
1 from .common import InfoExtractor
2 from ..utils import ExtractorError, traverse_obj
5 class IsraelNationalNewsIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>\d+)'
7 _TESTS = [{
8 'url': 'https://www.israelnationalnews.com/news/354520',
9 'info_dict': {
10 'id': '354520',
12 'playlist': [{
13 'info_dict': {
14 'id': 'jA84wQhVvg8',
15 'title': 'Even CNN Host Is Shocked by How Bad Biden\'s Approval Ratings Have Gotten | DM CLIPS | Rubin Report',
16 'ext': 'mp4',
17 'description': 'md5:b7325a3d00c7596337dc3ae37e32d35c',
18 'channel': 'The Rubin Report',
19 'channel_follower_count': int,
20 'comment_count': int,
21 'categories': ['News & Politics'],
22 'like_count': int,
23 'uploader_url': 'http://www.youtube.com/user/RubinReport',
24 'uploader_id': 'RubinReport',
25 'availability': 'public',
26 'view_count': int,
27 'duration': 240,
28 'thumbnail': 'https://i.ytimg.com/vi_webp/jA84wQhVvg8/maxresdefault.webp',
29 'live_status': 'not_live',
30 'playable_in_embed': True,
31 'age_limit': 0,
32 'tags': 'count:29',
33 'channel_id': 'UCJdKr0Bgd_5saZYqLCa9mng',
34 'channel_url': 'https://www.youtube.com/channel/UCJdKr0Bgd_5saZYqLCa9mng',
35 'upload_date': '20220606',
36 'uploader': 'The Rubin Report',
38 }],
41 def _real_extract(self, url):
42 news_article_id = self._match_id(url)
43 article_json = self._download_json(
44 f'https://www.israelnationalnews.com/Generic/NewAPI/Item?type=0&Item={news_article_id}', news_article_id)
46 urls = traverse_obj(article_json, ('Content2', ..., 'content', ..., 'attrs', 'src'))
47 if not urls:
48 raise ExtractorError('This article does not have any videos', expected=True)
50 return self.playlist_from_matches(urls, news_article_id, ie='Youtube')