Update backend.py

remove buffer and reset download_episodes req.get
This commit is contained in:
Arctic4161 2021-10-14 22:50:40 -05:00 committed by GitHub
parent e9e89e3159
commit 2f9ba1c78b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,12 +111,11 @@ class Download:
"Connection": "keep-alive"}
def download_episodes(self, url):
client = req.session()
with client.get(url[1], headers=self.random_headers(), stream=True, timeout=10) as workingurl:
with req.get(url[1], headers=self.random_headers(), stream=True, timeout=10) as workingurl:
episode_name = "EP." + url[0] + ".mp4"
file_loc = os.path.join(self.folder, episode_name)
with open(file_loc, "w+b") as file:
shutil.copyfileobj(workingurl.raw, file, 8192)
shutil.copyfileobj(workingurl.raw, file)
@dataclass(init=True)