mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 08:35:12 +00:00 
			
		
		
		
	[extractor/niconico] Always use HTTPS for requests
This prevents MITM attacks from malicious parties like insane ISPs Closes #5469
This commit is contained in:
		@@ -231,7 +231,7 @@ class NiconicoIE(InfoExtractor):
 | 
				
			|||||||
            or self._parse_json(
 | 
					            or self._parse_json(
 | 
				
			||||||
                self._html_search_regex(
 | 
					                self._html_search_regex(
 | 
				
			||||||
                    'data-api-data="([^"]+)"',
 | 
					                    'data-api-data="([^"]+)"',
 | 
				
			||||||
                    self._download_webpage('http://www.nicovideo.jp/watch/' + video_id, video_id),
 | 
					                    self._download_webpage('https://www.nicovideo.jp/watch/' + video_id, video_id),
 | 
				
			||||||
                    'API data', default='{}'),
 | 
					                    'API data', default='{}'),
 | 
				
			||||||
                video_id))
 | 
					                video_id))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -390,7 +390,7 @@ class NiconicoIE(InfoExtractor):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            webpage, handle = self._download_webpage_handle(
 | 
					            webpage, handle = self._download_webpage_handle(
 | 
				
			||||||
                'http://www.nicovideo.jp/watch/' + video_id, video_id)
 | 
					                'https://www.nicovideo.jp/watch/' + video_id, video_id)
 | 
				
			||||||
            if video_id.startswith('so'):
 | 
					            if video_id.startswith('so'):
 | 
				
			||||||
                video_id = self._match_id(handle.geturl())
 | 
					                video_id = self._match_id(handle.geturl())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -728,7 +728,7 @@ class NicovideoSearchBaseIE(InfoExtractor):
 | 
				
			|||||||
            webpage = self._download_webpage(url, item_id, query=query, note=note % {'page': page_num})
 | 
					            webpage = self._download_webpage(url, item_id, query=query, note=note % {'page': page_num})
 | 
				
			||||||
            results = re.findall(r'(?<=data-video-id=)["\']?(?P<videoid>.*?)(?=["\'])', webpage)
 | 
					            results = re.findall(r'(?<=data-video-id=)["\']?(?P<videoid>.*?)(?=["\'])', webpage)
 | 
				
			||||||
            for item in results:
 | 
					            for item in results:
 | 
				
			||||||
                yield self.url_result(f'http://www.nicovideo.jp/watch/{item}', 'Niconico', item)
 | 
					                yield self.url_result(f'https://www.nicovideo.jp/watch/{item}', 'Niconico', item)
 | 
				
			||||||
            if not results:
 | 
					            if not results:
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user