Skip to content

Commit

Permalink
[extractor/niconico] Always use HTTPS for requests
Browse files Browse the repository at this point in the history
This prevents MITM attacks from malicious parties like insane ISPs

Closes #5469
  • Loading branch information
Lesmiscore committed Nov 7, 2022
1 parent e9ce4e9 commit c7e4ab2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions yt_dlp/extractor/niconico.py
Expand Up @@ -231,7 +231,7 @@ def _get_heartbeat_info(self, info_dict):
or self._parse_json(
self._html_search_regex(
'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='{}'),
video_id))

Expand Down Expand Up @@ -390,7 +390,7 @@ def _real_extract(self, url):

try:
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'):
video_id = self._match_id(handle.geturl())

Expand Down Expand Up @@ -728,7 +728,7 @@ def _entries(self, url, item_id, query=None, note='Downloading page %(page)s'):
webpage = self._download_webpage(url, item_id, query=query, note=note % {'page': page_num})
results = re.findall(r'(?<=data-video-id=)["\']?(?P<videoid>.*?)(?=["\'])', webpage)
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:
break

Expand Down

0 comments on commit c7e4ab2

Please sign in to comment.