Skip to content

Bulk asynchronous downloader for multiple file hosts

GoFile Folders revisit (we must go deeper), improved and simplified.

Jules-WinnfieldX0a0fd384085c
diff --git a/URLs.txt b/URLs.txt
index e69de29bb..444dc6367 100644
--- a/URLs.txt
+++ b/URLs.txt
@@ -0,0 +1 @@
+https://gofile.io/d/6rs3Ky
\ No newline at end of file
diff --git a/utils/scrapers.py b/utils/scrapers.py
index 3059865b7..f30f7e8c9 100644
--- a/utils/scrapers.py
+++ b/utils/scrapers.py
@@ -213,20 +213,26 @@ class GoFileSpider(Spider):
EC.presence_of_element_located((By.ID, 'contentId-download'))
)
cookies = self.driver.get_cookies()
- folder_links = self.driver.find_elements(By.CSS_SELECTOR, "div[class='col-md text-center text-md-right'] a[class=ajaxLink]")
+ folder_links = self.driver.find_elements(By.CSS_SELECTOR,
+ "div[class='col-md text-center text-md-right'] a[class=ajaxLink]")
links = self.driver.find_elements(By.XPATH, "//button[@id='contentId-download']/..")
try:
title = self.driver.find_element(By.ID, 'rowFolder-folderName').text
if title_setting:
title = title + " - " + response.url.split('/')[-1]
+ title = re.sub(r'[/]', "-", title)
except Exception as e:
title = response.url.split('/')[-1]
- title = re.sub(r'[/]', "-", title)
+ try:
+ og_title = response.meta.get('title')
+ title = og_title + "/" + title
+ except:
+ pass
for folder_link in folder_links:
link = folder_link.get_attribute("href")
- yield Request(link, self.folder_parse, meta={'title': title})
+ yield Request(link, self.parse, meta={'title': title})
for link in links:
link = link.get_attribute("href")
@@ -235,30 +241,6 @@ class GoFileSpider(Spider):
netloc = urlparse(link).netloc.replace('www.', '')
yield {'netloc': netloc, 'url': link, 'title': title, 'referal': response.url, 'cookies': cookies}
- def folder_parse(self, response, **kwargs):
- og_title = response.meta.get('title')
-
- self.driver.get(response.url)
- element = WebDriverWait(self.driver, 10).until(
- EC.presence_of_element_located((By.ID, 'contentId-download'))
- )
- cookies = self.driver.get_cookies()
- links = self.driver.find_elements(By.XPATH, "//button[@id='contentId-download']/..")
-
- try:
- title = self.driver.find_element(By.ID, 'rowFolder-folderName').text
- if title_setting:
- title = title + " - " + response.url.split('/')[-1]
- except Exception as e:
- title = response.url.split('/')[-1]
- title = re.sub(r'[/]', "-", title)
-
- title = og_title + "/" + title
- for link in links:
- link = link.get_attribute("href")
- netloc = urlparse(link).netloc.replace('www.', '')
- yield {'netloc': netloc, 'url': link, 'title': title, 'referal': response.url, 'cookies': cookies}
-
def closed(self, reason):
self.driver.close()