Update backend.py

This commit is contained in:
Arctic4161 2021-10-14 16:24:22 -05:00 committed by GitHub
parent 9d4dc53961
commit bda3ead826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,6 @@ from bs4 import BeautifulSoup
from dataclasses import dataclass from dataclasses import dataclass
from colorama import Fore from colorama import Fore
from random import choice from random import choice
import time
@dataclass(init=True) @dataclass(init=True)
@ -102,11 +101,10 @@ class Download:
def download_episodes(self, url): def download_episodes(self, url):
client = req.session() client = req.session()
with client.get(url[1], headers=self.random_headers(), stream=True, timeout=10) as workingurl: with client.get(url[1], headers=self.random_headers(), stream=True, timeout=10) as workingurl:
time.sleep(1)
episode_name = "EP." + url[0] + ".mp4" episode_name = "EP." + url[0] + ".mp4"
file_loc = os.path.join(self.folder, episode_name) file_loc = os.path.join(self.folder, episode_name)
with open(file_loc, "w+b") as file: with open(file_loc, "w+b") as file:
shutil.copyfileobj(workingurl.raw, file) shutil.copyfileobj(workingurl.raw, file, 8192)
@dataclass(init=True) @dataclass(init=True)