Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Attempting fix for Bunkr Added response status check on download attempt. (possibly missign acceptable status codes)
Mitch Petersend876c83d73d5
diff --git a/downloader.py b/downloader.pyindex 55fe36e1f..b12e32ec5 100644--- a/downloader.py+++ b/downloader.py@@ -80,10 +80,14 @@ def download(passed_from_main):log(" Downloading " + filename + "...", Fore.LIGHTBLACK_EX)- with open(_path + str(filenameTemp), "ab" if resume else "wb") as out_file:- for chunk in response.iter_content(chunk_size=50000):- if chunk:- out_file.write(chunk)+ if response.status_code == 200 or response.status_code == 206:+ with open(_path + str(filenameTemp), "ab" if resume else "wb") as out_file:+ for chunk in response.iter_content(chunk_size=50000):+ if chunk:+ out_file.write(chunk)+ else:+ raise Exception("HTTP response code " + str(response.status_code))+del responseif os.path.isfile(_path + str(filenameTemp)):totalFileSize = incomingFileSize if storedFileSize is None else (@@ -158,12 +162,12 @@ if __name__ == '__main__':print(dirName)dirName = dirName.split("–")[0]- elif 'bunk' in url.lower():- dirName = soup.select('h1.title')[0].text.strip()-elif 'putme.ga' or 'pixl' in url.lower():dirName = soup.find("meta", {"property": "og:title"}).attrs['content']+ elif 'bunk' in url.lower():+ dirName = soup.select('h1.title')[0].text.strip()+rstr = r"[\/\\\:\*\?\"\<\>\|\.]" # '/ \ : * ? " < > | .'dirName = re.sub(rstr, "_", dirName)dirName += "/"diff --git a/geturls.py b/geturls.pyindex 21885adbe..671eb885d 100644--- a/geturls.py+++ b/geturls.py@@ -26,6 +26,8 @@ def Extrair_Links(baseURL):elif 'bunk' in baseURL.lower():for link in soup.find_all(class_="image"):lis = link.get('href')+ if '.mp4' in lis:+ lis = lis.replace('https://cdn.bunkr.to/', 'https://cdn.bunkr.to/s/')links.append(lis)# If dmca.gripe find 'a', {'class': 'download-button'} href links