Skip to content

Commit

Permalink
v4.8.2 (breakdowns#129)
Browse files Browse the repository at this point in the history
- direct link generator: Added Racaty, Hxfile, Anonfiles,
Fembed (femax20 & layarkacaxxi), Onedrive (only works for file not folder for now, thanks to UsergeTeam) support
- aria: Added more tracker

Co-authored-by: Ncode2014 <[email protected]>
  • Loading branch information
breakdowns and Ncode2014 authored Jun 4, 2021
1 parent b490a58 commit b709b8e
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 16 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# Features supported:

## Additional Features
- Mirroring Uptobox.com links to Google Drive (Uptobox account must be premium)
- Get detailed info about replied media
- Nyaa.si and Sukebei Torrent search
- Speedtest with picture results
Expand All @@ -27,24 +26,28 @@
- Check Heroku dynos stats
- Custom image support
- Counting file/folder
- Racaty.net support
- Shell and Executor
- Stickers module

- Direct links supported:
```
Racaty, Hxfile, Anonfiles,
Fembed (femax20 & layarkacaxxi), Onedrive (Only works for file not folder)
```
## From Original Repos
- Mirroring direct download links, Torrent, and Telegram files to Google Drive
- Mirroring Mega.nz links to Google Drive (If your Mega account not premium, it will limit 4-5gb/day)
- Mirroring Uptobox.com links to Google Drive (Uptobox account must be premium)
- Copy files from someone's Drive to your Drive (Using Autorclone)
- Download/upload progress, speeds and ETAs
- Download/Upload progress, Speeds and ETAs
- Mirror all Youtube-dl supported links
- Docker support
- Uploading to Team Drive
- Index Link support
- Service Account support
- Delete files from Drive
- Shortener support
- Custom Filename (Only for url, Telegram files and Youtube-dl. Not for Mega links and Magnet/Torrents)
- Extracting password protected files, using custom filename and download from password protected index links see these examples:
- Custom Filename (Only for URL, Telegram files and Youtube-dl. Not for Mega links and Magnet/Torrents)
- Extracting password protected files, using custom filename and download from password protected Index Links see these examples:
<p><a href="https://telegra.ph/Magneto-Python-Aria---Custom-Filename-Examples-01-20"> <img src="https://img.shields.io/badge/see%20on%20telegraph-grey?style=for-the-badge" width="190""/></a></p>

- Extract these filetypes and uploads to Google Drive
Expand Down Expand Up @@ -207,11 +210,13 @@ Many thanks to [AutoRClone](https://github.com/xyou365/AutoRclone) for the scrip
**NOTE**: Using Service Accounts is only recommended while uploading to a Team Drive.

## Generate Service Accounts. [What is Service Account](https://cloud.google.com/iam/docs/service-accounts)
<details>
<summary><b>Click here for more details</b></summary>

Let us create only the Service Accounts that we need.
**Warning**: abuse of this feature is not the aim of this project and we do **NOT** recommend that you make a lot of projects, just one project and 100 SAs allow you plenty of use, its also possible that over abuse might get your projects banned by Google.

`Note: 1 Service Account can copy around 750gb a day, 1 project can make 100 Service Accounts so that's 75tb a day, for most users this should easily suffice. `
**NOTE:** 1 Service Account can copy around 750gb a day, 1 project can make 100 Service Accounts so that's 75tb a day, for most users this should easily suffice.
```
python3 gen_sa_accounts.py --quick-setup 1 --new-only
```
Expand Down Expand Up @@ -256,14 +261,16 @@ Then add emails from emails.txt to Google Group, after that add Google Group to
python3 gen_sa_accounts.py --download-keys project_id
```

</details>

## Add all the Service Accounts to the Team Drive
- Run:
```
python3 add_to_team_drive.py -d SharedTeamDriveSrcID
```

# Youtube-dl authentication using .netrc file
For using your premium accounts in Youtube-dl or for protected index links, edit the netrc file according to following format:
For using your premium accounts in Youtube-dl or for protected Index Links, edit the netrc file according to following format:
```
machine host login username password my_youtube_password
```
Expand Down
2 changes: 1 addition & 1 deletion aria.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export MAX_DOWNLOAD_SPEED=0
tracker_list=$(curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt --next https://ngosang.github.io/trackerslist/trackers_all_http.txt --next https://newtrackon.com/api/all --next https://raw.githubusercontent.com/DeSireFire/animeTrackerList/master/AT_all.txt | awk '$1' | tr '\n\n' ',')
tracker_list=$(curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt --next https://ngosang.github.io/trackerslist/trackers_all_http.txt --next https://newtrackon.com/api/all --next https://raw.githubusercontent.com/DeSireFire/animeTrackerList/master/AT_all.txt --next https://raw.githubusercontent.com/hezhijie0327/Trackerslist/main/trackerslist_tracker.txt --next https://raw.githubusercontent.com/hezhijie0327/Trackerslist/main/trackerslist_exclude.txt | awk '$1' | tr '\n\n' ',')
export MAX_CONCURRENT_DOWNLOADS=7

aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false \
Expand Down
99 changes: 96 additions & 3 deletions bot/helper/mirror_utils/download_utils/direct_link_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
import urllib.parse
from os import popen
from random import choice
from urllib.parse import urlparse

import lk21
import requests
from bs4 import BeautifulSoup
from js2py import EvalJs
from lk21.extractors.bypasser import Bypass
from base64 import standard_b64encode

from bot.helper.ext_utils.exceptions import DirectDownloadLinkException

Expand All @@ -44,9 +48,20 @@ def direct_link_generator(link: str):
return github(link)
elif 'racaty.net' in link:
return racaty(link)
elif 'hxfile.co' in link:
return hxfile(link)
elif 'anonfiles.com' in link:
return anon(link)
elif 'femax20.com' in link:
return femax20(link)
elif 'layarkacaxxi.icu' in link:
return layarkacaxxi(link)
elif '1drv.ms' in link:
return onedrive(link)
else:
raise DirectDownloadLinkException(f'No Direct link function found for {link}')


def zippy_share(url: str) -> str:
link = re.findall("https:/.(.*?).zippyshare", url)[0]
response_content = (requests.get(url)).content
Expand Down Expand Up @@ -74,7 +89,7 @@ def zippy_share(url: str) -> str:

def yandex_disk(url: str) -> str:
""" Yandex.Disk direct links generator
Based on https://github.com/wldhx/yadisk-direct"""
Based on https://github.com/wldhx/yadisk-direct """
try:
link = re.findall(r'\bhttps?://.*yadi\.sk\S+', url)[0]
except IndexError:
Expand All @@ -85,12 +100,12 @@ def yandex_disk(url: str) -> str:
dl_url = requests.get(api.format(link)).json()['href']
return dl_url
except KeyError:
raise DirectDownloadLinkException("`Error: File not found / Download limit reached`\n")
raise DirectDownloadLinkException("`Error: File not found/Download limit reached`\n")


def cm_ru(url: str) -> str:
""" cloud.mail.ru direct links generator
Using https://github.com/JrMasterModelBuilder/cmrudl.py"""
Using https://github.com/JrMasterModelBuilder/cmrudl.py """
reply = ''
try:
link = re.findall(r'\bhttps?://.*cloud\.mail\.ru\S+', url)[0]
Expand All @@ -106,6 +121,7 @@ def cm_ru(url: str) -> str:
dl_url = data['download']
return dl_url


def uptobox(url: str) -> str:
""" Uptobox direct links generator
based on https://github.com/jovanzers/WinTenCermin """
Expand Down Expand Up @@ -176,6 +192,8 @@ def github(url: str) -> str:


def racaty(url: str) -> str:
""" Racaty direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*racaty\.net\S+', url)[0]
Expand All @@ -191,6 +209,81 @@ def racaty(url: str) -> str:
return dl_url


def hxfile(url: str) -> str:
""" Hxfile direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*hxfile\.co\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("`No Hxfile links found`\n")
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_url(link)
return dl_url


def anon(url: str) -> str:
""" Anonfiles direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*anonfiles\.com\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("`No Anonfiles links found`\n")
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_url(link)
return dl_url


def femax20(url: str) -> str:
""" Fembed direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*femax20\.com\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("`No Fembed links found`\n")
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link)
lst_link = []
count = len(dl_url)
for i in dl_url:
lst_link.append(dl_url[i])
return lst_link[count-1]


def layarkacaxxi(url: str) -> str:
""" Fembed direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*layarkacaxxi\.icu\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("No Fembed links found\n")
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link)
lst_link = []
count = len(dl_url)
for i in dl_url:
lst_link.append(dl_url[i])
return lst_link[count-1]


def onedrive(link: str) -> str:
""" Onedrive direct link generator
Based on https://github.com/UsergeTeam/Userge """
link_without_query = urlparse(link)._replace(query=None).geturl()
direct_link_encoded = str(standard_b64encode(bytes(link_without_query, "utf-8")), "utf-8")
direct_link1 = f"https://api.onedrive.com/v1.0/shares/u!{direct_link_encoded}/root/content"
resp = requests.head(direct_link1)
if resp.status_code != 302:
return "`Error: Unauthorized link, the link may be private`"
dl_link = resp.next.url
file_name = dl_link.rsplit("/", 1)[1]
resp2 = requests.head(dl_link)
return dl_link


def useragent():
"""
useragent random setter
Expand Down
8 changes: 4 additions & 4 deletions bot/modules/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ def onUploadComplete(self, link: str, size, files, folders, typ):
share_url = f'{INDEX_URL}/{url_path}'
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
msg += "\n\n<b>Type: </b>Folder"
msg += f"\n<b>SubFolders: </b>{folders}"
msg += f"\n<b>Files: </b>{files}"
msg += '\n\n<b>Type: </b>Folder'
msg += f'\n<b>SubFolders: </b>{folders}'
msg += f'\n<b>Files: </b>{files}'
else:
msg += f"\n\n<b>Type: </b>{typ}"
msg += f'\n\n<b>Type: </b>{typ}'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
buttons.buildbutton("⚡Index Link⚡", siurl)
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ google-auth-oauthlib
heroku3
html-telegraph-poster
js2py
lk21
lxml
messages
natsort
Pillow
psutil
psycopg2-binary
pybase64
pyrogram
python-dotenv
python-magic
Expand Down

0 comments on commit b709b8e

Please sign in to comment.