mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	[ie/N1] Fix extraction of newer articles (#12514)
Authored by: u-spec-png
This commit is contained in:
		| @@ -4,7 +4,9 @@ from .common import InfoExtractor | ||||
| from ..utils import ( | ||||
|     extract_attributes, | ||||
|     unified_timestamp, | ||||
|     url_or_none, | ||||
| ) | ||||
| from ..utils.traversal import traverse_obj | ||||
| 
 | ||||
| 
 | ||||
| class N1InfoAssetIE(InfoExtractor): | ||||
| @@ -35,9 +37,9 @@ class N1InfoIIE(InfoExtractor): | ||||
|     IE_NAME = 'N1Info:article' | ||||
|     _VALID_URL = r'https?://(?:(?:\w+\.)?n1info\.\w+|nova\.rs)/(?:[^/?#]+/){1,2}(?P<id>[^/?#]+)' | ||||
|     _TESTS = [{ | ||||
|         # Youtube embedded | ||||
|         # YouTube embedded | ||||
|         'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/', | ||||
|         'md5': '01ddb6646d0fd9c4c7d990aa77fe1c5a', | ||||
|         'md5': '987ce6fd72acfecc453281e066b87973', | ||||
|         'info_dict': { | ||||
|             'id': 'L5Hd4hQVUpk', | ||||
|             'ext': 'mp4', | ||||
| @@ -45,7 +47,26 @@ class N1InfoIIE(InfoExtractor): | ||||
|             'title': 'Ozmo i USO21, ep. 13: Novak Đoković – Danil Medvedev | Ključevi Poraza, Budućnost | SPORT KLUB TENIS', | ||||
|             'description': 'md5:467f330af1effedd2e290f10dc31bb8e', | ||||
|             'uploader': 'Sport Klub', | ||||
|             'uploader_id': 'sportklub', | ||||
|             'uploader_id': '@sportklub', | ||||
|             'uploader_url': 'https://www.youtube.com/@sportklub', | ||||
|             'channel': 'Sport Klub', | ||||
|             'channel_id': 'UChpzBje9Ro6CComXe3BgNaw', | ||||
|             'channel_url': 'https://www.youtube.com/channel/UChpzBje9Ro6CComXe3BgNaw', | ||||
|             'channel_is_verified': True, | ||||
|             'channel_follower_count': int, | ||||
|             'comment_count': int, | ||||
|             'view_count': int, | ||||
|             'like_count': int, | ||||
|             'age_limit': 0, | ||||
|             'duration': 1049, | ||||
|             'thumbnail': 'https://i.ytimg.com/vi/L5Hd4hQVUpk/maxresdefault.jpg', | ||||
|             'chapters': 'count:9', | ||||
|             'categories': ['Sports'], | ||||
|             'tags': 'count:10', | ||||
|             'timestamp': 1631522787, | ||||
|             'playable_in_embed': True, | ||||
|             'availability': 'public', | ||||
|             'live_status': 'not_live', | ||||
|         }, | ||||
|     }, { | ||||
|         'url': 'https://rs.n1info.com/vesti/djilas-los-plan-za-metro-nece-resiti-nijedan-saobracajni-problem/', | ||||
| @@ -55,6 +76,7 @@ class N1InfoIIE(InfoExtractor): | ||||
|             'title': 'Đilas: Predlog izgradnje metroa besmislen; SNS odbacuje navode', | ||||
|             'upload_date': '20210924', | ||||
|             'timestamp': 1632481347, | ||||
|             'thumbnail': 'http://n1info.rs/wp-content/themes/ucnewsportal-n1/dist/assets/images/placeholder-image-video.jpg', | ||||
|         }, | ||||
|         'params': { | ||||
|             'skip_download': True, | ||||
| @@ -67,6 +89,7 @@ class N1InfoIIE(InfoExtractor): | ||||
|             'title': 'Zadnji dnevi na kopališču Ilirija: “Ilirija ni umrla, ubili so jo”', | ||||
|             'timestamp': 1632567630, | ||||
|             'upload_date': '20210925', | ||||
|             'thumbnail': 'https://n1info.si/wp-content/uploads/2021/09/06/1630945843-tomaz3.png', | ||||
|         }, | ||||
|         'params': { | ||||
|             'skip_download': True, | ||||
| @@ -81,6 +104,14 @@ class N1InfoIIE(InfoExtractor): | ||||
|             'upload_date': '20210924', | ||||
|             'timestamp': 1632448649.0, | ||||
|             'uploader': 'YouLotWhatDontStop', | ||||
|             'display_id': 'pu9wbx', | ||||
|             'channel_id': 'serbia', | ||||
|             'comment_count': int, | ||||
|             'like_count': int, | ||||
|             'dislike_count': int, | ||||
|             'age_limit': 0, | ||||
|             'duration': 134, | ||||
|             'thumbnail': 'https://external-preview.redd.it/5nmmawSeGx60miQM3Iq-ueC9oyCLTLjjqX-qqY8uRsc.png?format=pjpg&auto=webp&s=2f973400b04d23f871b608b178e47fc01f9b8f1d', | ||||
|         }, | ||||
|         'params': { | ||||
|             'skip_download': True, | ||||
| @@ -93,6 +124,7 @@ class N1InfoIIE(InfoExtractor): | ||||
|             'title': 'Žaklina Tatalović Ani Brnabić: Pričate laži (VIDEO)', | ||||
|             'upload_date': '20211102', | ||||
|             'timestamp': 1635861677, | ||||
|             'thumbnail': 'https://nova.rs/wp-content/uploads/2021/11/02/1635860298-TNJG_Ana_Brnabic_i_Zaklina_Tatalovic_100_dana_Vlade_GP.jpg', | ||||
|         }, | ||||
|     }, { | ||||
|         'url': 'https://n1info.rs/vesti/cuta-biti-u-kosovskoj-mitrovici-znaci-da-te-docekaju-eksplozivnim-napravama/', | ||||
| @@ -104,6 +136,16 @@ class N1InfoIIE(InfoExtractor): | ||||
|             'timestamp': 1687290536, | ||||
|             'thumbnail': 'https://cdn.brid.tv/live/partners/26827/snapshot/1332368_th_6492013a8356f_1687290170.jpg', | ||||
|         }, | ||||
|     }, { | ||||
|         'url': 'https://n1info.rs/vesti/vuciceva-turneja-po-srbiji-najavljuje-kontrarevoluciju-preti-svom-narodu-vredja-novinare/', | ||||
|         'info_dict': { | ||||
|             'id': '2025974', | ||||
|             'ext': 'mp4', | ||||
|             'title': 'Vučićeva turneja po Srbiji: Najavljuje kontrarevoluciju, preti svom narodu, vređa novinare', | ||||
|             'thumbnail': 'https://cdn-uc.brid.tv/live/partners/26827/snapshot/2025974_fhd_67c4a23280a81_1740939826.jpg', | ||||
|             'timestamp': 1740939936, | ||||
|             'upload_date': '20250302', | ||||
|         }, | ||||
|     }, { | ||||
|         'url': 'https://hr.n1info.com/vijesti/pravobraniteljica-o-ubojstvu-u-zagrebu-radi-se-o-doista-nezapamcenoj-situaciji/', | ||||
|         'only_matching': True, | ||||
| @@ -115,11 +157,11 @@ class N1InfoIIE(InfoExtractor): | ||||
| 
 | ||||
|         title = self._html_search_regex(r'<h1[^>]+>(.+?)</h1>', webpage, 'title') | ||||
|         timestamp = unified_timestamp(self._html_search_meta('article:published_time', webpage)) | ||||
|         plugin_data = self._html_search_meta('BridPlugin', webpage) | ||||
|         plugin_data = re.findall(r'\$bp\("(?:Brid|TargetVideo)_\d+",\s(.+)\);', webpage) | ||||
|         entries = [] | ||||
|         if plugin_data: | ||||
|             site_id = self._html_search_regex(r'site:(\d+)', webpage, 'site id') | ||||
|             for video_data in re.findall(r'\$bp\("Brid_\d+", (.+)\);', webpage): | ||||
|             for video_data in plugin_data: | ||||
|                 video_id = self._parse_json(video_data, title)['video'] | ||||
|                 entries.append({ | ||||
|                     'id': video_id, | ||||
| @@ -140,7 +182,7 @@ class N1InfoIIE(InfoExtractor): | ||||
|                     'url': video_data.get('data-url'), | ||||
|                     'id': video_data.get('id'), | ||||
|                     'title': title, | ||||
|                     'thumbnail': video_data.get('data-thumbnail'), | ||||
|                     'thumbnail': traverse_obj(video_data, (('data-thumbnail', 'data-default_thumbnail'), {url_or_none}, any)), | ||||
|                     'timestamp': timestamp, | ||||
|                     'ie_key': 'N1InfoAsset', | ||||
|                 }) | ||||
| @@ -152,7 +194,7 @@ class N1InfoIIE(InfoExtractor): | ||||
|             if url.startswith('https://www.youtube.com'): | ||||
|                 entries.append(self.url_result(url, ie='Youtube')) | ||||
|             elif url.startswith('https://www.redditmedia.com'): | ||||
|                 entries.append(self.url_result(url, ie='RedditR')) | ||||
|                 entries.append(self.url_result(url, ie='Reddit')) | ||||
| 
 | ||||
|         return { | ||||
|             '_type': 'playlist', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 u-spec-png
					u-spec-png