Skip to content

Commit

Permalink
Merge pull request #203 from OverflowCat/master
Browse files Browse the repository at this point in the history
fix: support Python 3.13 (resolve #202)
  • Loading branch information
HFrost0 authored Jan 17, 2024
2 parents 2efb887 + 691be63 commit 26dbb9e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bilix/download/base_downloader_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import uuid
import random
import os
import cgi
from email.message import Message
from pymp4.parser import Box
from bilix.download.base_downloader import BaseDownloader
from bilix.download.utils import path_check, merge_files
Expand Down Expand Up @@ -48,8 +48,9 @@ async def _pre_req(self, urls: List[str]) -> Tuple[int, str]:
total = int(res.headers['Content-Range'].split('/')[-1])
# get filename
if content_disposition := res.headers.get('Content-Disposition', None):
key, pdict = cgi.parse_header(content_disposition)
filename = pdict.get('filename', '')
m = Message()
m['content-type'] = content_disposition
filename = m.get_param('filename', '')
else:
filename = ''
# change origin url to redirected position to avoid twice redirect
Expand Down

0 comments on commit 26dbb9e

Please sign in to comment.