Skip to content

Commit a7b3de1

Browse files
committed
fix subtitle download
1 parent 77fbd6f commit a7b3de1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

edx_helper/edx_dl.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,17 +854,18 @@ def download_subtitle_without_name(url, target_dir, filename, headers):
854854
"""
855855
Downloads the subtitle from the url
856856
"""
857-
response = requests.get(url, headers)
857+
# response = requests.get(url, headers)
858+
response = requests.get(url)
858859
if not filename:
859860
resp_headers = response.headers['Content-Disposition']
860861
m = re.compile(r'filename="(.*)"').search(resp_headers)
861862
if m:
862863
filename = m.group(1)
863864
else:
864-
logging.warning('Not setting file name for: %s', url)
865+
logging.error('Not setting file name for: %s', url)
865866
return
866867
file_path = os.path.join(target_dir, filename)
867-
with open(file_path, 'wb', encoding='utf-8') as f:
868+
with open(file_path, 'wb') as f:
868869
f.write(response.content)
869870

870871

0 commit comments

Comments
 (0)