mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-11-16 07:48:01 +01:00
[extractor/IsraelNationalNews] Add extractor (#5089)
Closes #4019 Authored by: Bobscorn
This commit is contained in:
parent
4d37720a0c
commit
0d887f273a
2 changed files with 51 additions and 0 deletions
|
@ -755,6 +755,7 @@ from .islamchannel import (
|
|||
IslamChannelIE,
|
||||
IslamChannelSeriesIE,
|
||||
)
|
||||
from .israelnationalnews import IsraelNationalNewsIE
|
||||
from .itprotv import (
|
||||
ITProTVIE,
|
||||
ITProTVCourseIE
|
||||
|
|
50
yt_dlp/extractor/israelnationalnews.py
Normal file
50
yt_dlp/extractor/israelnationalnews.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
from .common import InfoExtractor
|
||||
from ..utils import ExtractorError, traverse_obj
|
||||
|
||||
|
||||
class IsraelNationalNewsIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>\d+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.israelnationalnews.com/news/354520',
|
||||
'info_dict': {
|
||||
'id': '354520'
|
||||
},
|
||||
'playlist': [{
|
||||
'info_dict': {
|
||||
'id': 'jA84wQhVvg8',
|
||||
'title': 'Even CNN Host Is Shocked by How Bad Biden\'s Approval Ratings Have Gotten | DM CLIPS | Rubin Report',
|
||||
'ext': 'mp4',
|
||||
'description': 'md5:b7325a3d00c7596337dc3ae37e32d35c',
|
||||
'channel': 'The Rubin Report',
|
||||
'channel_follower_count': int,
|
||||
'comment_count': int,
|
||||
'categories': ['News & Politics'],
|
||||
'like_count': int,
|
||||
'uploader_url': 'http://www.youtube.com/user/RubinReport',
|
||||
'uploader_id': 'RubinReport',
|
||||
'availability': 'public',
|
||||
'view_count': int,
|
||||
'duration': 240,
|
||||
'thumbnail': 'https://i.ytimg.com/vi_webp/jA84wQhVvg8/maxresdefault.webp',
|
||||
'live_status': 'not_live',
|
||||
'playable_in_embed': True,
|
||||
'age_limit': 0,
|
||||
'tags': 'count:29',
|
||||
'channel_id': 'UCJdKr0Bgd_5saZYqLCa9mng',
|
||||
'channel_url': 'https://www.youtube.com/channel/UCJdKr0Bgd_5saZYqLCa9mng',
|
||||
'upload_date': '20220606',
|
||||
'uploader': 'The Rubin Report',
|
||||
}
|
||||
}]
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
news_article_id = self._match_id(url)
|
||||
article_json = self._download_json(
|
||||
f'https://www.israelnationalnews.com/Generic/NewAPI/Item?type=0&Item={news_article_id}', news_article_id)
|
||||
|
||||
urls = traverse_obj(article_json, ('Content2', ..., 'content', ..., 'attrs', 'src'))
|
||||
if not urls:
|
||||
raise ExtractorError('This article does not have any videos', expected=True)
|
||||
|
||||
return self.playlist_from_matches(urls, news_article_id, ie='Youtube')
|
Loading…
Reference in a new issue