Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit b709b8e

Browse files
breakdownsNcode2014
andauthored
v4.8.2 (#129)
- 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]>
1 parent b490a58 commit b709b8e

File tree

5 files changed

+118
-16
lines changed

5 files changed

+118
-16
lines changed

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# Features supported:
1818

1919
## Additional Features
20-
- Mirroring Uptobox.com links to Google Drive (Uptobox account must be premium)
2120
- Get detailed info about replied media
2221
- Nyaa.si and Sukebei Torrent search
2322
- Speedtest with picture results
@@ -27,24 +26,28 @@
2726
- Check Heroku dynos stats
2827
- Custom image support
2928
- Counting file/folder
30-
- Racaty.net support
3129
- Shell and Executor
3230
- Stickers module
33-
31+
- Direct links supported:
32+
```
33+
Racaty, Hxfile, Anonfiles,
34+
Fembed (femax20 & layarkacaxxi), Onedrive (Only works for file not folder)
35+
```
3436
## From Original Repos
3537
- Mirroring direct download links, Torrent, and Telegram files to Google Drive
3638
- Mirroring Mega.nz links to Google Drive (If your Mega account not premium, it will limit 4-5gb/day)
39+
- Mirroring Uptobox.com links to Google Drive (Uptobox account must be premium)
3740
- Copy files from someone's Drive to your Drive (Using Autorclone)
38-
- Download/upload progress, speeds and ETAs
41+
- Download/Upload progress, Speeds and ETAs
3942
- Mirror all Youtube-dl supported links
4043
- Docker support
4144
- Uploading to Team Drive
4245
- Index Link support
4346
- Service Account support
4447
- Delete files from Drive
4548
- Shortener support
46-
- Custom Filename (Only for url, Telegram files and Youtube-dl. Not for Mega links and Magnet/Torrents)
47-
- Extracting password protected files, using custom filename and download from password protected index links see these examples:
49+
- Custom Filename (Only for URL, Telegram files and Youtube-dl. Not for Mega links and Magnet/Torrents)
50+
- Extracting password protected files, using custom filename and download from password protected Index Links see these examples:
4851
<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>
4952

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

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

211216
Let us create only the Service Accounts that we need.
212217
**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.
213218

214-
`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. `
219+
**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.
215220
```
216221
python3 gen_sa_accounts.py --quick-setup 1 --new-only
217222
```
@@ -256,14 +261,16 @@ Then add emails from emails.txt to Google Group, after that add Google Group to
256261
python3 gen_sa_accounts.py --download-keys project_id
257262
```
258263

264+
</details>
265+
259266
## Add all the Service Accounts to the Team Drive
260267
- Run:
261268
```
262269
python3 add_to_team_drive.py -d SharedTeamDriveSrcID
263270
```
264271

265272
# Youtube-dl authentication using .netrc file
266-
For using your premium accounts in Youtube-dl or for protected index links, edit the netrc file according to following format:
273+
For using your premium accounts in Youtube-dl or for protected Index Links, edit the netrc file according to following format:
267274
```
268275
machine host login username password my_youtube_password
269276
```

aria.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export MAX_DOWNLOAD_SPEED=0
2-
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' ',')
2+
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' ',')
33
export MAX_CONCURRENT_DOWNLOADS=7
44

55
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false \

bot/helper/mirror_utils/download_utils/direct_link_generator.py

Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
import urllib.parse
1717
from os import popen
1818
from random import choice
19+
from urllib.parse import urlparse
1920

21+
import lk21
2022
import requests
2123
from bs4 import BeautifulSoup
2224
from js2py import EvalJs
25+
from lk21.extractors.bypasser import Bypass
26+
from base64 import standard_b64encode
2327

2428
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
2529

@@ -44,9 +48,20 @@ def direct_link_generator(link: str):
4448
return github(link)
4549
elif 'racaty.net' in link:
4650
return racaty(link)
51+
elif 'hxfile.co' in link:
52+
return hxfile(link)
53+
elif 'anonfiles.com' in link:
54+
return anon(link)
55+
elif 'femax20.com' in link:
56+
return femax20(link)
57+
elif 'layarkacaxxi.icu' in link:
58+
return layarkacaxxi(link)
59+
elif '1drv.ms' in link:
60+
return onedrive(link)
4761
else:
4862
raise DirectDownloadLinkException(f'No Direct link function found for {link}')
4963

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

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

90105

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

124+
109125
def uptobox(url: str) -> str:
110126
""" Uptobox direct links generator
111127
based on https://github.com/jovanzers/WinTenCermin """
@@ -176,6 +192,8 @@ def github(url: str) -> str:
176192

177193

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

193211

212+
def hxfile(url: str) -> str:
213+
""" Hxfile direct links generator
214+
based on https://github.com/breakdowns/slam-mirrorbot """
215+
dl_url = ''
216+
try:
217+
link = re.findall(r'\bhttps?://.*hxfile\.co\S+', url)[0]
218+
except IndexError:
219+
raise DirectDownloadLinkException("`No Hxfile links found`\n")
220+
bypasser = lk21.Bypass()
221+
dl_url=bypasser.bypass_url(link)
222+
return dl_url
223+
224+
225+
def anon(url: str) -> str:
226+
""" Anonfiles direct links generator
227+
based on https://github.com/breakdowns/slam-mirrorbot """
228+
dl_url = ''
229+
try:
230+
link = re.findall(r'\bhttps?://.*anonfiles\.com\S+', url)[0]
231+
except IndexError:
232+
raise DirectDownloadLinkException("`No Anonfiles links found`\n")
233+
bypasser = lk21.Bypass()
234+
dl_url=bypasser.bypass_url(link)
235+
return dl_url
236+
237+
238+
def femax20(url: str) -> str:
239+
""" Fembed direct links generator
240+
based on https://github.com/breakdowns/slam-mirrorbot """
241+
dl_url = ''
242+
try:
243+
link = re.findall(r'\bhttps?://.*femax20\.com\S+', url)[0]
244+
except IndexError:
245+
raise DirectDownloadLinkException("`No Fembed links found`\n")
246+
bypasser = lk21.Bypass()
247+
dl_url=bypasser.bypass_fembed(link)
248+
lst_link = []
249+
count = len(dl_url)
250+
for i in dl_url:
251+
lst_link.append(dl_url[i])
252+
return lst_link[count-1]
253+
254+
255+
def layarkacaxxi(url: str) -> str:
256+
""" Fembed direct links generator
257+
based on https://github.com/breakdowns/slam-mirrorbot """
258+
dl_url = ''
259+
try:
260+
link = re.findall(r'\bhttps?://.*layarkacaxxi\.icu\S+', url)[0]
261+
except IndexError:
262+
raise DirectDownloadLinkException("No Fembed links found\n")
263+
bypasser = lk21.Bypass()
264+
dl_url=bypasser.bypass_fembed(link)
265+
lst_link = []
266+
count = len(dl_url)
267+
for i in dl_url:
268+
lst_link.append(dl_url[i])
269+
return lst_link[count-1]
270+
271+
272+
def onedrive(link: str) -> str:
273+
""" Onedrive direct link generator
274+
Based on https://github.com/UsergeTeam/Userge """
275+
link_without_query = urlparse(link)._replace(query=None).geturl()
276+
direct_link_encoded = str(standard_b64encode(bytes(link_without_query, "utf-8")), "utf-8")
277+
direct_link1 = f"https://api.onedrive.com/v1.0/shares/u!{direct_link_encoded}/root/content"
278+
resp = requests.head(direct_link1)
279+
if resp.status_code != 302:
280+
return "`Error: Unauthorized link, the link may be private`"
281+
dl_link = resp.next.url
282+
file_name = dl_link.rsplit("/", 1)[1]
283+
resp2 = requests.head(dl_link)
284+
return dl_link
285+
286+
194287
def useragent():
195288
"""
196289
useragent random setter

bot/modules/mirror.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ def onUploadComplete(self, link: str, size, files, folders, typ):
161161
share_url = f'{INDEX_URL}/{url_path}'
162162
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
163163
share_url += '/'
164-
msg += "\n\n<b>Type: </b>Folder"
165-
msg += f"\n<b>SubFolders: </b>{folders}"
166-
msg += f"\n<b>Files: </b>{files}"
164+
msg += '\n\n<b>Type: </b>Folder'
165+
msg += f'\n<b>SubFolders: </b>{folders}'
166+
msg += f'\n<b>Files: </b>{files}'
167167
else:
168-
msg += f"\n\n<b>Type: </b>{typ}"
168+
msg += f'\n\n<b>Type: </b>{typ}'
169169
if SHORTENER is not None and SHORTENER_API is not None:
170170
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
171171
buttons.buildbutton("⚡Index Link⚡", siurl)

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ google-auth-oauthlib
1010
heroku3
1111
html-telegraph-poster
1212
js2py
13+
lk21
1314
lxml
1415
messages
1516
natsort
1617
Pillow
1718
psutil
1819
psycopg2-binary
20+
pybase64
1921
pyrogram
2022
python-dotenv
2123
python-magic

0 commit comments

Comments
 (0)