Skip to content

Bulk asynchronous downloader for multiple file hosts

Added new supported sites using Mango's work. Needs further testing.

Mitch Petersenb1bd2b99d17f
diff --git a/README.md b/README.md
index bcb65a211..b170d5c58 100644
--- a/README.md
+++ b/README.md
@@ -6,12 +6,12 @@ Cyberdrop.me
DMCA.Gripe
-In progress:
-
Putmega
Pixl
+Bunkr.to
+
# Information
Created Using Python 3.7.4
diff --git a/URLs.txt b/URLs.txt
index 8b1378917..c78fdb058 100644
--- a/URLs.txt
+++ b/URLs.txt
@@ -1 +1,3 @@
-
+https://pixl.is/album/lauren-dragneel-13-march-2021.yLtz
+https://putme.ga/album/yaelaris.RqRML
+https://cyberdrop.me/a/Fj17sbFe
diff --git a/downloader.py b/downloader.py
index 62e897933..0094b784c 100644
--- a/downloader.py
+++ b/downloader.py
@@ -7,6 +7,7 @@ import re
from colorama import Fore, Style
from geturls import Extrair_Links
from multiprocessing import Pool
+from bs4 import BeautifulSoup, SoupStrainer
import multiprocessing
import settings
@@ -106,6 +107,8 @@ if __name__ == '__main__':
latestVersion = response.json()["tag_name"]
currentVersion = "1.3.2"
+ clear()
+
if latestVersion != currentVersion:
print("A new version of CyberDropDownloader is available\n"
"Download it here: https://github.com/Jules-WinnfieldX/CyberDropDownloader/releases/latest\n")
@@ -123,7 +126,6 @@ if __name__ == '__main__':
log("The download folder specified (" + downloadFolder + ") does not exist ", Fore.RED)
totalFiles = 0
- clear()
if os.path.isfile("URLs.txt"):
print("URLs.txt exists")
@@ -138,14 +140,22 @@ if __name__ == '__main__':
for line in file_object:
url = line.rstrip()
- html = requests.get(url, headers=headers)
- htmlAsText = html.text
- dirName = htmlAsText[htmlAsText.find("<title>") + 7:htmlAsText.find("</title>")]
+ page = requests.get(url)
+ soup = BeautifulSoup(page.text, "html.parser")
+
if 'cyberdrop' in url.lower():
+ dirName = soup.select('h1.has-text-centered')[0].text.strip()
+ print(dirName)
dirName = dirName.split("–")[0]
- dirName = dirName[7:-1]
dirName = re.findall('^[^\[]*', dirName)
dirName = dirName[0].rstrip()
+
+ 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.py
index 3e1a0aa43..21885adbe 100644
--- a/geturls.py
+++ b/geturls.py
@@ -2,28 +2,34 @@ import requests
import os
from bs4 import BeautifulSoup, SoupStrainer
-
videoExtensions = ['.mp4', '.wmv', '.m4v']
-def Extrair_Links(u):
+def Extrair_Links(baseURL):
# Extract links from gallery
try:
- # create request, and soup
- url = u
- page = requests.get(url)
+ page = requests.get(baseURL)
data = page.text
soup = BeautifulSoup(data, features="html5lib")
links = []
+ pages = []
+
# If cyberdrop, find id="file" href links
- if 'cyberdrop' in u.lower():
+ if 'cyberdrop' in baseURL.lower():
for link in soup.find_all(id="file"):
lis = link.get('href')
if len(str(lis)) > 30:
lis = lis.replace('.nl/', '.cc/')
links.append(lis)
+
+ # If bunkr or bunkerleaks, find class="image" href links
+ elif 'bunk' in baseURL.lower():
+ for link in soup.find_all(class_="image"):
+ lis = link.get('href')
+ links.append(lis)
+
# If dmca.gripe find 'a', {'class': 'download-button'} href links
- elif 'dmca.gripe' in u.lower():
+ elif 'dmca.gripe' in baseURL.lower():
for link in soup.find_all('a', {'class': 'download-button'}):
lis = link.get('href')
if any(videoExtension in lis for videoExtension in videoExtensions):
@@ -31,25 +37,62 @@ def Extrair_Links(u):
links.append(gripeVideo(lis))
elif len(str(lis)) > 30:
links.append(lis)
- linksP = list(dict.fromkeys(links))
+
+ # If putme.ga or pixl, correct any bad urls, find all pages in album,
+ # find all image links and then correct all image links
+ elif 'putme.ga' or 'pixl' in baseURL.lower():
+ # First correct any 'bad' URLs by getting the real embedded url from the page itself
+ url = soup.find(attrs={"data-text": "album-name"}).get('href')
+ pages.append(url)
+
+ # Find all the pages within the album
+ while True:
+ # Searches for links within the page
+ request = requests.get(url)
+ soup = BeautifulSoup(request.text, 'html.parser')
+ # Searches for next page link
+ nextPage = soup.find("li", {'class': 'pagination-next'})
+ if nextPage is None:
+ break
+ else:
+ for child in nextPage.children:
+ childURL = child.get("href")
+ if childURL:
+ pages.append(childURL)
+ if not childURL:
+ break
+ else:
+ url = childURL
+
+ # Searches through links for image urls
+ request = requests.Session()
+ for link in pages:
+ with request.get(link) as r:
+ soup = BeautifulSoup(r.text, 'html.parser')
+ new = soup.find('div', {'class': 'pad-content-listing'})
+ brokenLinks = [image["src"] for image in new.findAll("img")]
+ for brokenLink in brokenLinks:
+ link = brokenLink.replace('.md.', '.').replace('.th.', '.')
+ links.append(link)
+ linksDict = list(dict.fromkeys(links))
+
except Exception as e:
print(e)
return None
else:
- return linksP
+ return linksDict
-def gripeVideo(u):
+def gripeVideo(url):
# extract direct video links from download page. This will likely break eventually.
try:
- url = u
page = requests.get(url)
data = page.text
soup = BeautifulSoup(data, features="html5lib")
for link in soup.find_all('a', {'class': 'btn btn-dl'}):
- lis = link.get('href')
- return "https://share.dmca.gripe" + lis
+ suffix = link.get('href')
+ return "https://share.dmca.gripe" + suffix
except Exception as e:
print(e)
return None