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

Commit

Permalink
v4.8.4
Browse files Browse the repository at this point in the history
- 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]>
  • Loading branch information
3 people authored Jun 8, 2021
1 parent ea8e229 commit e805e77
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 28 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
**Slam Mirror Bot** is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.

# Features supported:

## Additional Features
- Get detailed info about replied media (Only for Telegram file)
- Nyaa.si and Sukebei Torrent search
Expand All @@ -25,16 +24,18 @@
- Sudo with Database support
- Multiple Trackers support
- Check Heroku dynos stats
- Extracting **tar.xz** support
- Custom image support
- Counting file/folder
- Shell and Executor
- Stickers module
- View Link button (Not all Index support, recommended using [Bhadoo Index](https://github.com/ParveenBhadooOfficial/Google-Drive-Index))
- Direct links supported:
```
Racaty, Hxfile, Anonfiles, Fembed, Femax20, Layarkacaxxi,
Uptobox (Uptobox account must be premium),
Onedrive (Only works for file not folder or busines account)
Racaty.net, Hxfile.co, Anonfiles.com, Fembed.com, Femax20.com, Layarkacaxxi.icu,
Naniplay.com, Naniplay.nanime.in, Naniplay.nanime.biz, Sbembed.com, Streamsb.net,
Uptobox.com (Uptobox account must be premium),
Onedrive/1drv.ms (Only works for file not folder or busines account)
```
## From Original Repos
- Mirroring direct download links, Torrent, and Telegram files to Google Drive
Expand Down Expand Up @@ -139,7 +140,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **BLOCK_MEGA_FOLDER**: (Optional field) If you want to remove mega.nz folder support, set it to `True`.
- **BLOCK_MEGA_LINKS**: (Optional field) If you want to remove mega.nz mirror support, set it to `True`.
- **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)
- **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`.
- **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`.
- **ENABLE_FILESIZE_LIMIT**: Set it to `True` if you want to use `MAX_TORRENT_SIZE`.
- **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`.
- **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.
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"required": false
},
"CLONE_LIMIT": {
"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.",
"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.",
"required": false
},
"STOP_DUPLICATE_MIRROR": {
Expand Down
2 changes: 1 addition & 1 deletion aria.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certif
--follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
--peer-id-prefix=-qB4250- --user-agent=qBittorrent/4.2.5 \
--peer-id-prefix=-qB4350- --user-agent=qBittorrent/4.3.5 --peer-agent=qBittorrent/4.3.5 \
--disk-cache=64M --file-allocation=prealloc --continue=true \
--max-file-not-found=5 --max-tries=20 --auto-file-renaming=true \
--bt-enable-lpd=true --seed-time=0.01 --seed-ratio=1.0 \
Expand Down
2 changes: 2 additions & 0 deletions bot/helper/ext_utils/fs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def get_base_name(orig_path: str):
return orig_path.replace(".bz2", "")
elif orig_path.endswith(".gz"):
return orig_path.replace(".gz", "")
elif orig_path.endswith(".tar.xz"):
return orig_path.replace(".tar.xz", "")
elif orig_path.endswith(".tar"):
return orig_path.replace(".tar", "")
elif orig_path.endswith(".tbz2"):
Expand Down
40 changes: 21 additions & 19 deletions bot/helper/mirror_utils/download_utils/direct_link_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,22 @@ def direct_link_generator(link: str):
return hxfile(link)
elif 'anonfiles.com' in link:
return anon(link)
elif 'fembed.com' in link:
return fembed(link)
elif 'femax20.com' in link:
return femax20(link)
return fembed(link)
elif 'naniplay.nanime.in' in link:
return fembed(link)
elif 'naniplay.nanime.biz' in link:
return fembed(link)
elif 'naniplay.com' in link:
return fembed(link)
elif 'layarkacaxxi.icu' in link:
return layarkacaxxi(link)
return fembed(link)
elif 'sbembed.com' in link:
return sbembed(link)
elif 'streamsb.net' in link:
return sbembed(link)
elif '1drv.ms' in link:
return onedrive(link)
else:
Expand Down Expand Up @@ -235,14 +247,9 @@ def anon(url: str) -> str:
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")
def fembed(link: str) -> str:
""" Fembed direct link generator
Based on https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link)
lst_link = []
Expand All @@ -252,16 +259,11 @@ def femax20(url: str) -> str:
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")
def sbembed(link: str) -> str:
""" Sbembed direct link generator
Based on https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link)
dl_url=bypasser.bypass_sbembed(link)
lst_link = []
count = len(dl_url)
for i in dl_url:
Expand Down
5 changes: 3 additions & 2 deletions bot/helper/mirror_utils/download_utils/mega_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def onRequestFinish(self, api, request, error):
.format(request, error))
if str(error).lower() != "no error":
self.error = error.copy()
self.is_cancelled = True
self.listener.onDownloadError("\nMEGA Link you are trying to download is no longer available.")
return
request_type = request.getType()
if request_type == MegaRequest.TYPE_LOGIN:
Expand Down Expand Up @@ -165,8 +167,7 @@ def add_download(mega_link: str, path: str, listener):
folder_api.addListener(mega_listener)
executor.do(folder_api.loginToFolder, (mega_link,))
node = folder_api.authorizeNode(mega_listener.node)
if mega_listener.error is not None:
return listener.onDownloadError(str(mega_listener.error))

gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8))
mega_listener.setValues(node.getName(), api.getSize(node), gid)
executor.do(api.startDownload,(node,path))
5 changes: 5 additions & 0 deletions extract
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ extract() {
tar xzf "$arg" --one-top-level
local code=$?
;;
*.tar.xz)
a_dir=$(expr "$arg" : '\(.*\).tar.xz')
7z x "$arg" -o"$a_dir"
local code=$?
;;
*.zip)
a_dir=$(expr "$arg" : '\(.*\).zip')
7z x "$arg" -o"$a_dir"
Expand Down
5 changes: 5 additions & 0 deletions pextract
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ extract() {
tar xzf "$arg" --one-top-level
local code=$?
;;
*.tar.xz)
a_dir=$(expr "$arg" : '\(.*\).tar.xz')
7z x "$arg" -o"$a_dir" -p"$pswd"
local code=$?
;;
*.zip)
a_dir=$(expr "$arg" : '\(.*\).zip')
7z x "$arg" -o"$a_dir" -p"$pswd"
Expand Down

0 comments on commit e805e77

Please sign in to comment.