- 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 <Ncode2014@users.noreply.github.com>
Co-authored-by: FA Tulloh <77918734+yourtulloh@users.noreply.github.com>
This commit is contained in:
Hafitz Setya 2021-06-09 04:38:17 +07:00 committed by GitHub
parent ea8e2299ec
commit e805e7728f
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 28 deletions

View File

@ -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. **Slam Mirror Bot** is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
# Features supported: # Features supported:
## Additional Features ## Additional Features
- Get detailed info about replied media (Only for Telegram file) - Get detailed info about replied media (Only for Telegram file)
- Nyaa.si and Sukebei Torrent search - Nyaa.si and Sukebei Torrent search
@ -25,6 +24,7 @@
- Sudo with Database support - Sudo with Database support
- Multiple Trackers support - Multiple Trackers support
- Check Heroku dynos stats - Check Heroku dynos stats
- Extracting **tar.xz** support
- Custom image support - Custom image support
- Counting file/folder - Counting file/folder
- Shell and Executor - Shell and Executor
@ -32,9 +32,10 @@
- View Link button (Not all Index support, recommended using [Bhadoo Index](https://github.com/ParveenBhadooOfficial/Google-Drive-Index)) - View Link button (Not all Index support, recommended using [Bhadoo Index](https://github.com/ParveenBhadooOfficial/Google-Drive-Index))
- Direct links supported: - Direct links supported:
``` ```
Racaty, Hxfile, Anonfiles, Fembed, Femax20, Layarkacaxxi, Racaty.net, Hxfile.co, Anonfiles.com, Fembed.com, Femax20.com, Layarkacaxxi.icu,
Uptobox (Uptobox account must be premium), Naniplay.com, Naniplay.nanime.in, Naniplay.nanime.biz, Sbembed.com, Streamsb.net,
Onedrive (Only works for file not folder or busines account) Uptobox.com (Uptobox account must be premium),
Onedrive/1drv.ms (Only works for file not folder or busines account)
``` ```
## From Original Repos ## From Original Repos
- Mirroring direct download links, Torrent, and Telegram files to Google Drive - 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:
- **BLOCK_MEGA_FOLDER**: (Optional field) If you want to remove mega.nz folder support, set it to `True`. - **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`. - **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) - **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`. - **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`. - **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. - **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.

View File

@ -109,7 +109,7 @@
"required": false "required": false
}, },
"CLONE_LIMIT": { "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 "required": false
}, },
"STOP_DUPLICATE_MIRROR": { "STOP_DUPLICATE_MIRROR": {

View File

@ -8,7 +8,7 @@ aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certif
--follow-torrent=mem --split=10 \ --follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \ --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \ --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 \ --disk-cache=64M --file-allocation=prealloc --continue=true \
--max-file-not-found=5 --max-tries=20 --auto-file-renaming=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 \ --bt-enable-lpd=true --seed-time=0.01 --seed-ratio=1.0 \

View File

@ -69,6 +69,8 @@ def get_base_name(orig_path: str):
return orig_path.replace(".bz2", "") return orig_path.replace(".bz2", "")
elif orig_path.endswith(".gz"): elif orig_path.endswith(".gz"):
return orig_path.replace(".gz", "") return orig_path.replace(".gz", "")
elif orig_path.endswith(".tar.xz"):
return orig_path.replace(".tar.xz", "")
elif orig_path.endswith(".tar"): elif orig_path.endswith(".tar"):
return orig_path.replace(".tar", "") return orig_path.replace(".tar", "")
elif orig_path.endswith(".tbz2"): elif orig_path.endswith(".tbz2"):

View File

@ -52,10 +52,22 @@ def direct_link_generator(link: str):
return hxfile(link) return hxfile(link)
elif 'anonfiles.com' in link: elif 'anonfiles.com' in link:
return anon(link) return anon(link)
elif 'fembed.com' in link:
return fembed(link)
elif 'femax20.com' in 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: 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: elif '1drv.ms' in link:
return onedrive(link) return onedrive(link)
else: else:
@ -235,14 +247,9 @@ def anon(url: str) -> str:
return dl_url return dl_url
def femax20(url: str) -> str: def fembed(link: str) -> str:
""" Fembed direct links generator """ Fembed direct link generator
based on https://github.com/breakdowns/slam-mirrorbot """ 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() bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link) dl_url=bypasser.bypass_fembed(link)
lst_link = [] lst_link = []
@ -252,16 +259,11 @@ def femax20(url: str) -> str:
return lst_link[count-1] return lst_link[count-1]
def layarkacaxxi(url: str) -> str: def sbembed(link: str) -> str:
""" Fembed direct links generator """ Sbembed direct link generator
based on https://github.com/breakdowns/slam-mirrorbot """ 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() bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link) dl_url=bypasser.bypass_sbembed(link)
lst_link = [] lst_link = []
count = len(dl_url) count = len(dl_url)
for i in dl_url: for i in dl_url:

View File

@ -63,6 +63,8 @@ class MegaAppListener(MegaListener):
.format(request, error)) .format(request, error))
if str(error).lower() != "no error": if str(error).lower() != "no error":
self.error = error.copy() self.error = error.copy()
self.is_cancelled = True
self.listener.onDownloadError("\nMEGA Link you are trying to download is no longer available.")
return return
request_type = request.getType() request_type = request.getType()
if request_type == MegaRequest.TYPE_LOGIN: if request_type == MegaRequest.TYPE_LOGIN:
@ -165,8 +167,7 @@ class MegaDownloadHelper:
folder_api.addListener(mega_listener) folder_api.addListener(mega_listener)
executor.do(folder_api.loginToFolder, (mega_link,)) executor.do(folder_api.loginToFolder, (mega_link,))
node = folder_api.authorizeNode(mega_listener.node) 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)) gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8))
mega_listener.setValues(node.getName(), api.getSize(node), gid) mega_listener.setValues(node.getName(), api.getSize(node), gid)
executor.do(api.startDownload,(node,path)) executor.do(api.startDownload,(node,path))

View File

@ -37,6 +37,11 @@ extract() {
tar xzf "$arg" --one-top-level tar xzf "$arg" --one-top-level
local code=$? local code=$?
;; ;;
*.tar.xz)
a_dir=$(expr "$arg" : '\(.*\).tar.xz')
7z x "$arg" -o"$a_dir"
local code=$?
;;
*.zip) *.zip)
a_dir=$(expr "$arg" : '\(.*\).zip') a_dir=$(expr "$arg" : '\(.*\).zip')
7z x "$arg" -o"$a_dir" 7z x "$arg" -o"$a_dir"

View File

@ -38,6 +38,11 @@ extract() {
tar xzf "$arg" --one-top-level tar xzf "$arg" --one-top-level
local code=$? local code=$?
;; ;;
*.tar.xz)
a_dir=$(expr "$arg" : '\(.*\).tar.xz')
7z x "$arg" -o"$a_dir" -p"$pswd"
local code=$?
;;
*.zip) *.zip)
a_dir=$(expr "$arg" : '\(.*\).zip') a_dir=$(expr "$arg" : '\(.*\).zip')
7z x "$arg" -o"$a_dir" -p"$pswd" 7z x "$arg" -o"$a_dir" -p"$pswd"