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

Commit e805e77

Browse files
breakdownsNcode2014gitenvx
authored
v4.8.4
- Added support for tar.xz - Fix Mega auto canceling if deleted file (#145) - Direct link generator: Addad Naniplay.com, Naniplay.nanime.biz, Sbembed.com, Streamsb.net support Co-authored-by: Ncode2014 <[email protected]> Co-authored-by: FA Tulloh <[email protected]>
1 parent ea8e229 commit e805e77

File tree

8 files changed

+44
-28
lines changed

8 files changed

+44
-28
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
**Slam Mirror Bot** is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
1616

1717
# Features supported:
18-
1918
## Additional Features
2019
- Get detailed info about replied media (Only for Telegram file)
2120
- Nyaa.si and Sukebei Torrent search
@@ -25,16 +24,18 @@
2524
- Sudo with Database support
2625
- Multiple Trackers support
2726
- Check Heroku dynos stats
27+
- Extracting **tar.xz** support
2828
- Custom image support
2929
- Counting file/folder
3030
- Shell and Executor
3131
- Stickers module
3232
- View Link button (Not all Index support, recommended using [Bhadoo Index](https://github.com/ParveenBhadooOfficial/Google-Drive-Index))
3333
- Direct links supported:
3434
```
35-
Racaty, Hxfile, Anonfiles, Fembed, Femax20, Layarkacaxxi,
36-
Uptobox (Uptobox account must be premium),
37-
Onedrive (Only works for file not folder or busines account)
35+
Racaty.net, Hxfile.co, Anonfiles.com, Fembed.com, Femax20.com, Layarkacaxxi.icu,
36+
Naniplay.com, Naniplay.nanime.in, Naniplay.nanime.biz, Sbembed.com, Streamsb.net,
37+
Uptobox.com (Uptobox account must be premium),
38+
Onedrive/1drv.ms (Only works for file not folder or busines account)
3839
```
3940
## From Original Repos
4041
- Mirroring direct download links, Torrent, and Telegram files to Google Drive
@@ -139,7 +140,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
139140
- **BLOCK_MEGA_FOLDER**: (Optional field) If you want to remove mega.nz folder support, set it to `True`.
140141
- **BLOCK_MEGA_LINKS**: (Optional field) If you want to remove mega.nz mirror support, set it to `True`.
141142
- **STOP_DUPLICATE_MIRROR**: (Optional field) (Leave empty if unsure) if this field is set to `True`, bot will check file in drive, if it is present in Drive, downloading will be stopped. (**Note**: File will be checked using filename, not using filehash, so this feature is not perfect yet)
142-
- **CLONE_LIMIT**: To limit cloning Google Drive (leave space between number and unit (tb or gb only)), examples: if you fill `1 gb` it will limit `1gb`.
143+
- **CLONE_LIMIT**: To limit cloning Google Drive (leave space between number and unit, **tb or gb only**), examples: if you fill `1 gb` it will limit `1gb`.
143144
- **ENABLE_FILESIZE_LIMIT**: Set it to `True` if you want to use `MAX_TORRENT_SIZE`.
144145
- **MAX_TORRENT_SIZE**: To limit the Torrent mirror size, Fill The amount you want to limit, examples: if you fill `15` it will limit `15gb`.
145146
- **IMAGE_URL**: (Optional field) Show Image/Logo in /start message. Fill value of image your link image, use telegra.ph or any direct link image.

app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"required": false
110110
},
111111
"CLONE_LIMIT": {
112-
"description": "To limit cloning Google Drive (leave space between number and unit (tb or gb only)), examples: if you fill 1 gb it will limit 1gb.",
112+
"description": "To limit cloning Google Drive (leave space between number and unit, tb or gb only), examples: if you fill 1 gb it will limit 1gb.",
113113
"required": false
114114
},
115115
"STOP_DUPLICATE_MIRROR": {

aria.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certif
88
--follow-torrent=mem --split=10 \
99
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
1010
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
11-
--peer-id-prefix=-qB4250- --user-agent=qBittorrent/4.2.5 \
11+
--peer-id-prefix=-qB4350- --user-agent=qBittorrent/4.3.5 --peer-agent=qBittorrent/4.3.5 \
1212
--disk-cache=64M --file-allocation=prealloc --continue=true \
1313
--max-file-not-found=5 --max-tries=20 --auto-file-renaming=true \
1414
--bt-enable-lpd=true --seed-time=0.01 --seed-ratio=1.0 \

bot/helper/ext_utils/fs_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def get_base_name(orig_path: str):
6969
return orig_path.replace(".bz2", "")
7070
elif orig_path.endswith(".gz"):
7171
return orig_path.replace(".gz", "")
72+
elif orig_path.endswith(".tar.xz"):
73+
return orig_path.replace(".tar.xz", "")
7274
elif orig_path.endswith(".tar"):
7375
return orig_path.replace(".tar", "")
7476
elif orig_path.endswith(".tbz2"):

bot/helper/mirror_utils/download_utils/direct_link_generator.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,22 @@ def direct_link_generator(link: str):
5252
return hxfile(link)
5353
elif 'anonfiles.com' in link:
5454
return anon(link)
55+
elif 'fembed.com' in link:
56+
return fembed(link)
5557
elif 'femax20.com' in link:
56-
return femax20(link)
58+
return fembed(link)
59+
elif 'naniplay.nanime.in' in link:
60+
return fembed(link)
61+
elif 'naniplay.nanime.biz' in link:
62+
return fembed(link)
63+
elif 'naniplay.com' in link:
64+
return fembed(link)
5765
elif 'layarkacaxxi.icu' in link:
58-
return layarkacaxxi(link)
66+
return fembed(link)
67+
elif 'sbembed.com' in link:
68+
return sbembed(link)
69+
elif 'streamsb.net' in link:
70+
return sbembed(link)
5971
elif '1drv.ms' in link:
6072
return onedrive(link)
6173
else:
@@ -235,14 +247,9 @@ def anon(url: str) -> str:
235247
return dl_url
236248

237249

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")
250+
def fembed(link: str) -> str:
251+
""" Fembed direct link generator
252+
Based on https://github.com/breakdowns/slam-mirrorbot """
246253
bypasser = lk21.Bypass()
247254
dl_url=bypasser.bypass_fembed(link)
248255
lst_link = []
@@ -252,16 +259,11 @@ def femax20(url: str) -> str:
252259
return lst_link[count-1]
253260

254261

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")
262+
def sbembed(link: str) -> str:
263+
""" Sbembed direct link generator
264+
Based on https://github.com/breakdowns/slam-mirrorbot """
263265
bypasser = lk21.Bypass()
264-
dl_url=bypasser.bypass_fembed(link)
266+
dl_url=bypasser.bypass_sbembed(link)
265267
lst_link = []
266268
count = len(dl_url)
267269
for i in dl_url:

bot/helper/mirror_utils/download_utils/mega_downloader.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def onRequestFinish(self, api, request, error):
6363
.format(request, error))
6464
if str(error).lower() != "no error":
6565
self.error = error.copy()
66+
self.is_cancelled = True
67+
self.listener.onDownloadError("\nMEGA Link you are trying to download is no longer available.")
6668
return
6769
request_type = request.getType()
6870
if request_type == MegaRequest.TYPE_LOGIN:
@@ -165,8 +167,7 @@ def add_download(mega_link: str, path: str, listener):
165167
folder_api.addListener(mega_listener)
166168
executor.do(folder_api.loginToFolder, (mega_link,))
167169
node = folder_api.authorizeNode(mega_listener.node)
168-
if mega_listener.error is not None:
169-
return listener.onDownloadError(str(mega_listener.error))
170+
170171
gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8))
171172
mega_listener.setValues(node.getName(), api.getSize(node), gid)
172173
executor.do(api.startDownload,(node,path))

extract

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ extract() {
3737
tar xzf "$arg" --one-top-level
3838
local code=$?
3939
;;
40+
*.tar.xz)
41+
a_dir=$(expr "$arg" : '\(.*\).tar.xz')
42+
7z x "$arg" -o"$a_dir"
43+
local code=$?
44+
;;
4045
*.zip)
4146
a_dir=$(expr "$arg" : '\(.*\).zip')
4247
7z x "$arg" -o"$a_dir"

pextract

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ extract() {
3838
tar xzf "$arg" --one-top-level
3939
local code=$?
4040
;;
41+
*.tar.xz)
42+
a_dir=$(expr "$arg" : '\(.*\).tar.xz')
43+
7z x "$arg" -o"$a_dir" -p"$pswd"
44+
local code=$?
45+
;;
4146
*.zip)
4247
a_dir=$(expr "$arg" : '\(.*\).zip')
4348
7z x "$arg" -o"$a_dir" -p"$pswd"

0 commit comments

Comments
 (0)