Skip to content

Commit

Permalink
Added FilePress Scraper (SilentDemonSD#63)
Browse files Browse the repository at this point in the history
* Added Playwwright

* Added FilePress

* Added FilePress Scraper

* Added FilePress Download Support

* Added FilePress Clone Support

* Added FilePress Mirror-Leech Support
  • Loading branch information
MajnuRangeela authored Dec 7, 2022
1 parent 223575e commit e2678e5
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ RUN chmod 777 /usr/src/app

COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
RUN playwright install chromium
RUN playwright install-deps
RUN apt-get update && apt-get upgrade -y
RUN apt -qq update --fix-missing && \
apt -qq install -y mediainfo

COPY . .

CMD ["bash", "start.sh"]
CMD ["bash", "start.sh"]
4 changes: 4 additions & 0 deletions bot/helper/ext_utils/bot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ def is_sharedrive_link(url: str):
url = re_match(r'https?://(sharedrive)\.\S+', url)
return bool(url)

def is_filepress_link(url: str):
url = re_match(r'https?://(filepress|filebee)\.\S+', url)
return bool(url)

def is_mega_link(url: str):
return "mega.nz" in url or "mega.co.nz" in url

Expand Down
40 changes: 40 additions & 0 deletions bot/helper/mirror_utils/download_utils/direct_link_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from base64 import standard_b64encode, b64decode
from selenium import webdriver
from selenium.webdriver.common.by import By
from playwright.sync_api import Playwright, sync_playwright, expect

from bot import LOGGER, config_dict
from bot.helper.telegram_helper.bot_commands import BotCommands
Expand Down Expand Up @@ -92,6 +93,8 @@ def direct_link_generator(link: str):
return sharer_pw_dl(link)
elif is_sharedrive_link(link):
return shareDrive(link)
elif is_filepress_link(link):
return filepress(link)
elif any(x in link for x in fmed_list):
return fembed(link)
elif any(x in link for x in ['sbembed.com', 'watchsb.com', 'streamsb.net', 'sbplay.org']):
Expand Down Expand Up @@ -807,3 +810,40 @@ def shareDrive(url,directLogin=True):
return driveUrl
else:
raise DirectDownloadLinkException("ERROR! File Not Found or User rate exceeded !!")

def prun(playwright: Playwright, link:str) -> str:
""" filepress google drive link generator
By https://t.me/maverick9099
GitHub: https://github.com/majnurangeela"""

browser = playwright.chromium.launch()
context = browser.new_context()

page = context.new_page()
page.goto(link)

firstbtn = page.locator("xpath=//div[text()='Direct Download']/parent::button")
expect(firstbtn).to_be_visible()
firstbtn.click()
sleep(10)

secondBtn = page.get_by_role("button", name="Download Now")
expect(secondBtn).to_be_visible()
with page.expect_navigation():
secondBtn.click()

Flink = page.url

context.close()
browser.close()

if 'drive.google.com' in Flink:
return Flink
else:
raise DirectDownloadLinkException("Unable To Get Google Drive Link!")


def filepress(link:str) -> str:
with sync_playwright() as playwright:
flink = prun(playwright, link)
return flink
2 changes: 1 addition & 1 deletion bot/helper/mirror_utils/download_utils/gd_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from bot.helper.ext_utils.fs_utils import get_base_name, check_storage_threshold


def add_gd_download(link, path, listener, newname, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive):
def add_gd_download(link, path, listener, newname, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive, is_filepress):
res, size, name, files = GoogleDriveHelper().helper(link)
if res != "":
return sendMessage(res, listener.bot, listener.message)
Expand Down
5 changes: 4 additions & 1 deletion bot/modules/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def _clone(message, bot):
is_udrive = is_udrive_link(link)
is_sharer = is_sharer_link(link)
is_sharedrive = is_sharedrive_link(link)
if (is_gdtot or is_unified or is_udrive or is_sharer or is_sharedrive):
is_filepress = is_filepress_link(link)
if (is_gdtot or is_unified or is_udrive or is_sharer or is_sharedrive or is_filepress):
try:
msg = sendMessage(f"Processing: <code>{link}</code>", bot, message)
LOGGER.info(f"Processing: {link}")
Expand All @@ -155,6 +156,8 @@ def _clone(message, bot):
link = sharer_pw_dl(link)
if is_sharedrive:
link = shareDrive(link)
if is_filepress:
link = filepress(link)
LOGGER.info(f"Processing GdToT: {link}")
deleteMessage(bot, msg)
except DirectDownloadLinkException as e:
Expand Down
4 changes: 3 additions & 1 deletion bot/modules/mirror_leech.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def _mirror_leech(bot, message, isZip=False, extract=False, isQbit=False, isLeec
is_udrive = False
is_sharer = False
is_sharedrive = False
is_filepress = False
index = 1
ratio = None
seed_time = None
Expand Down Expand Up @@ -227,6 +228,7 @@ def _mirror_leech(bot, message, isZip=False, extract=False, isQbit=False, isLeec
is_udrive = is_udrive_link(link)
is_sharer = is_sharer_link(link)
is_sharedrive = is_sharedrive_link(link)
is_filepress = is_filepress_link(link)
link = direct_link_generator(link)
LOGGER.info(f"Generated link: {link}")
except DirectDownloadLinkException as e:
Expand Down Expand Up @@ -268,7 +270,7 @@ def _mirror_leech(bot, message, isZip=False, extract=False, isQbit=False, isLeec
gmsg += f"Use /{BotCommands.UnzipMirrorCommand} to extracts Google Drive archive file"
sendMessage(gmsg, bot, message)
else:
Thread(target=add_gd_download, args=(link, f'{DOWNLOAD_DIR}{listener.uid}', listener, name, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive)).start()
Thread(target=add_gd_download, args=(link, f'{DOWNLOAD_DIR}{listener.uid}', listener, name, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive, is_filepress)).start()
elif is_mega_link(link):
Thread(target=add_mega_download, args=(link, f'{DOWNLOAD_DIR}{listener.uid}/', listener, name)).start()
elif isQbit and (is_magnet(link) or ospath.exists(link)):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ urllib3
xattr
yt-dlp
waybackpy
playwright

0 comments on commit e2678e5

Please sign in to comment.