Compare commits

..

No commits in common. "5d135d8a06962c514d92921ddd588c9ac53408c2" and "5abc4d3ae01916d7bd3c113f40961704f2f1f570" have entirely different histories.

View File

@ -1,4 +1,4 @@
from .common import InfoExtractor from yt_dlp.extractor.common import InfoExtractor
import re import re
@ -17,7 +17,8 @@ class MaarivIE(InfoExtractor):
@staticmethod @staticmethod
def extract_resolution(url): def extract_resolution(url):
match = re.search(r'(\d{2,4}x\d{2,4})\.mp4$', url) pattern = r'(\d{2,4}x\d{2,4})\.mp4$'
match = re.search(pattern, url)
return match.group(1) if match else None return match.group(1) if match else None
def _real_extract(self, url): def _real_extract(self, url):
@ -25,13 +26,13 @@ class MaarivIE(InfoExtractor):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
# Find the correct iframes # Find the correct iframes
video_urls = re.findall(r'<iframe [^>]?poster="([^"]+)"[^>]+ src="([^"]+)"', webpage) video_urls = re.findall(r'<iframe .*?poster="(.*?)" src="(.*?)"', webpage)
video_info_list = [] video_info_list = []
for thumbnail, src in video_urls: for thumbnail, src in video_urls:
media_param = re.search(r'media=(\d+)', src).group(1) media_param = re.search(r'media=(\d+)', src).group(1)
info_json = self._download_json(f"https://dal.walla.co.il/media/{media_param}?origin=player.maariv.co.il", info_url = f"https://dal.walla.co.il/media/{media_param}?origin=player.maariv.co.il"
video_id) info_json = self._download_json(info_url, video_id)
data = info_json['data'] data = info_json['data']
main_video_to_download_filename = data['video']['file_name'] main_video_to_download_filename = data['video']['file_name']
main_video_to_download_url = data['video']['url'] main_video_to_download_url = data['video']['url']
@ -47,11 +48,13 @@ class MaarivIE(InfoExtractor):
for format_id, stream_url_object in enumerate(data['video']['stream_urls'], start=1): for format_id, stream_url_object in enumerate(data['video']['stream_urls'], start=1):
stream_url = stream_url_object['stream_url'] stream_url = stream_url_object['stream_url']
format_list.append({ resolution = self.extract_resolution(stream_url)
format_info = {
'format_id': str(format_id), 'format_id': str(format_id),
'url': stream_url, 'url': stream_url,
'resolution': self.extract_resolution(stream_url), 'resolution': resolution,
}) }
format_list.append(format_info)
video_info = { video_info = {
'id': media_param, 'id': media_param,