Update direct links & remove rpc-listen-port, coz default is 6800
This commit is contained in:
parent
8e090988b1
commit
42f017c824
13
README.md
13
README.md
|
|
@ -4,20 +4,22 @@
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|
|
||||||

|

|
||||||

|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
[](https://t.me/SlamMirrorUpdates)
|

|
||||||
|
[](https://t.me/SlamMirrorUpdates)
|
||||||
|
|
||||||
**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:
|
||||||
|
<details>
|
||||||
|
<summary><b>Click Here For More Details</b></summary>
|
||||||
|
|
||||||
## Additional Features
|
## Additional Features
|
||||||
- Updater (**NOTE**: You must upload your **token.pickle** to Index and fill your **token.pickle** url to **TOKEN_PICKLE_URL**, because your **token.pickle** will deleted after update)
|
- Updater (**NOTE**: You must upload your **token.pickle** to Index and fill your **token.pickle** url to **TOKEN_PICKLE_URL**, because your **token.pickle** will deleted after update, for more info please check [Setting up config file](https://github.com/breakdowns/slam-mirrorbot/tree/master#setting-up-config-file))
|
||||||
- Limiting size Torrent/Direct, Tar/Unzip, Mega, cloning Google Drive support
|
- Limiting size Torrent/Direct, Tar/Unzip, Mega, cloning Google Drive support
|
||||||
- Get detailed info about replied media (Only for Telegram file)
|
- Get detailed info about replied media (Only for Telegram file)
|
||||||
- Stop duplicate cloning Google Drive & mirroring Mega support
|
- Stop duplicate cloning Google Drive & mirroring Mega support
|
||||||
|
|
@ -29,6 +31,7 @@
|
||||||
- Extracting **tar.xz** support
|
- Extracting **tar.xz** support
|
||||||
- Heroku config support
|
- Heroku config support
|
||||||
- Custom Image support
|
- Custom Image support
|
||||||
|
- Custom Progress bar
|
||||||
- Counting file/folder
|
- Counting file/folder
|
||||||
- View Link button
|
- View Link button
|
||||||
- Shell and Executor
|
- Shell and Executor
|
||||||
|
|
@ -69,6 +72,8 @@ HFS, LZH, LZMA, LZMA2, MBR, MSI, MSLZ, NSIS,
|
||||||
NTFS, RPM, SquashFS, UDF, VHD, XAR, Z.
|
NTFS, RPM, SquashFS, UDF, VHD, XAR, Z.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
# How to deploy?
|
# How to deploy?
|
||||||
Deploying is pretty much straight forward and is divided into several steps as follows:
|
Deploying is pretty much straight forward and is divided into several steps as follows:
|
||||||
## Installing requirements
|
## Installing requirements
|
||||||
|
|
|
||||||
6
aria.sh
6
aria.sh
|
|
@ -1,14 +1,14 @@
|
||||||
export MAX_DOWNLOAD_SPEED=0
|
export MAX_DOWNLOAD_SPEED=0
|
||||||
tracker_list=$(curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt https://ngosang.github.io/trackerslist/trackers_all_http.txt https://newtrackon.com/api/all https://raw.githubusercontent.com/DeSireFire/animeTrackerList/master/AT_all.txt https://raw.githubusercontent.com/hezhijie0327/Trackerslist/main/trackerslist_tracker.txt https://raw.githubusercontent.com/hezhijie0327/Trackerslist/main/trackerslist_exclude.txt | awk '$0' | tr '\n\n' ',')
|
tracker_list=$(curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt https://ngosang.github.io/trackerslist/trackers_all_http.txt https://newtrackon.com/api/all https://raw.githubusercontent.com/DeSireFire/animeTrackerList/master/AT_all.txt https://raw.githubusercontent.com/hezhijie0327/Trackerslist/main/trackerslist_tracker.txt https://raw.githubusercontent.com/hezhijie0327/Trackerslist/main/trackerslist_exclude.txt | awk '$0' | tr '\n' ',')
|
||||||
export MAX_CONCURRENT_DOWNLOADS=7
|
export MAX_CONCURRENT_DOWNLOADS=7
|
||||||
|
|
||||||
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port=6800 --check-certificate=false \
|
aria2c --enable-rpc --rpc-listen-all=false --check-certificate=false \
|
||||||
--max-connection-per-server=10 --rpc-max-request-size=1024M \
|
--max-connection-per-server=10 --rpc-max-request-size=1024M \
|
||||||
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --bt-tracker-connect-timeout=300 --bt-stop-timeout=1200 --min-split-size=10M \
|
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --bt-tracker-connect-timeout=300 --bt-stop-timeout=1200 --min-split-size=10M \
|
||||||
--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=-qB4350- --user-agent=qBittorrent/4.3.5 --peer-agent=qBittorrent/4.3.5 \
|
--peer-id-prefix=-qB4360- --user-agent=qBittorrent/4.3.6 --peer-agent=qBittorrent/4.3.6 \
|
||||||
--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 \
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
|
||||||
def direct_link_generator(link: str):
|
def direct_link_generator(link: str):
|
||||||
""" direct links generator """
|
""" direct links generator """
|
||||||
if not link:
|
if not link:
|
||||||
raise DirectDownloadLinkException("`No links found!`")
|
raise DirectDownloadLinkException("No links found!")
|
||||||
elif 'youtube.com' in link or 'youtu.be' in link:
|
elif 'youtube.com' in link or 'youtu.be' in link:
|
||||||
raise DirectDownloadLinkException(f"Use /{BotCommands.WatchCommand} to mirror Youtube link\nUse /{BotCommands.TarWatchCommand} to make tar of Youtube playlist")
|
raise DirectDownloadLinkException(f"Use /{BotCommands.WatchCommand} to mirror Youtube link\nUse /{BotCommands.TarWatchCommand} to make tar of Youtube playlist")
|
||||||
elif 'zippyshare.com' in link:
|
elif 'zippyshare.com' in link:
|
||||||
|
|
@ -87,29 +87,29 @@ def direct_link_generator(link: str):
|
||||||
|
|
||||||
def zippy_share(url: str) -> str:
|
def zippy_share(url: str) -> str:
|
||||||
""" ZippyShare direct links generator
|
""" ZippyShare direct links generator
|
||||||
Based on https://github.com/KenHV/Mirror-Bot """
|
Based on https://github.com/KenHV/Mirror-Bot
|
||||||
link = re.findall("https:/.(.*?).zippyshare", url)[0]
|
https://github.com/jovanzers/WinTenCermin """
|
||||||
response_content = (requests.get(url)).content
|
|
||||||
bs_obj = BeautifulSoup(response_content, "lxml")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
js_script = bs_obj.find("div", {"class": "center",}).find_all(
|
link = re.findall(r'\bhttps?://.*zippyshare\.com\S+', url)[0]
|
||||||
"script"
|
except IndexError:
|
||||||
)[1]
|
raise DirectDownloadLinkException("No Zippyshare links found")
|
||||||
except:
|
try:
|
||||||
js_script = bs_obj.find("div", {"class": "right",}).find_all(
|
base_url = re.search('http.+.zippyshare.com', link).group()
|
||||||
"script"
|
response = requests.get(link).content
|
||||||
)[0]
|
pages = BeautifulSoup(response, "lxml")
|
||||||
|
try:
|
||||||
js_content = re.findall(r'\.href.=."/(.*?)";', str(js_script))
|
js_script = pages.find("div", {"class": "center"}).find_all("script")[1]
|
||||||
js_content = 'var x = "/' + js_content[0] + '"'
|
except IndexError:
|
||||||
|
js_script = pages.find("div", {"class": "right"}).find_all("script")[0]
|
||||||
evaljs = EvalJs()
|
js_content = re.findall(r'\.href.=."/(.*?)";', str(js_script))
|
||||||
setattr(evaljs, "x", None)
|
js_content = 'var x = "/' + js_content[0] + '"'
|
||||||
evaljs.execute(js_content)
|
evaljs = EvalJs()
|
||||||
js_content = getattr(evaljs, "x")
|
setattr(evaljs, "x", None)
|
||||||
|
evaljs.execute(js_content)
|
||||||
return f"https://{link}.zippyshare.com{js_content}"
|
js_content = getattr(evaljs, "x")
|
||||||
|
return base_url + js_content
|
||||||
|
except IndexError:
|
||||||
|
raise DirectDownloadLinkException("Can't find download button")
|
||||||
|
|
||||||
|
|
||||||
def yandex_disk(url: str) -> str:
|
def yandex_disk(url: str) -> str:
|
||||||
|
|
@ -118,14 +118,14 @@ def yandex_disk(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*yadi\.sk\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*yadi\.sk\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
reply = "`No Yandex.Disk links found`\n"
|
reply = "No Yandex.Disk links found\n"
|
||||||
return reply
|
return reply
|
||||||
api = 'https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key={}'
|
api = 'https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key={}'
|
||||||
try:
|
try:
|
||||||
dl_url = requests.get(api.format(link)).json()['href']
|
dl_url = requests.get(api.format(link)).json()['href']
|
||||||
return dl_url
|
return dl_url
|
||||||
except KeyError:
|
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:
|
def cm_ru(url: str) -> str:
|
||||||
|
|
@ -135,14 +135,14 @@ def cm_ru(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*cloud\.mail\.ru\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*cloud\.mail\.ru\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No cloud.mail.ru links found`\n")
|
raise DirectDownloadLinkException("No cloud.mail.ru links found\n")
|
||||||
command = f'vendor/cmrudl.py/cmrudl -s {link}'
|
command = f'vendor/cmrudl.py/cmrudl -s {link}'
|
||||||
result = popen(command).read()
|
result = popen(command).read()
|
||||||
result = result.splitlines()[-1]
|
result = result.splitlines()[-1]
|
||||||
try:
|
try:
|
||||||
data = json.loads(result)
|
data = json.loads(result)
|
||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
raise DirectDownloadLinkException("`Error: Can't extract the link`\n")
|
raise DirectDownloadLinkException("Error: Can't extract the link\n")
|
||||||
dl_url = data['download']
|
dl_url = data['download']
|
||||||
return dl_url
|
return dl_url
|
||||||
|
|
||||||
|
|
@ -153,7 +153,7 @@ def uptobox(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*uptobox\.com\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*uptobox\.com\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No Uptobox links found`\n")
|
raise DirectDownloadLinkException("No Uptobox links found\n")
|
||||||
if UPTOBOX_TOKEN is None:
|
if UPTOBOX_TOKEN is None:
|
||||||
LOGGER.error('UPTOBOX_TOKEN not provided!')
|
LOGGER.error('UPTOBOX_TOKEN not provided!')
|
||||||
dl_url = link
|
dl_url = link
|
||||||
|
|
@ -175,7 +175,7 @@ def mediafire(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*mediafire\.com\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*mediafire\.com\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No MediaFire links found`\n")
|
raise DirectDownloadLinkException("No MediaFire links found\n")
|
||||||
page = BeautifulSoup(requests.get(link).content, 'lxml')
|
page = BeautifulSoup(requests.get(link).content, 'lxml')
|
||||||
info = page.find('a', {'aria-label': 'Download file'})
|
info = page.find('a', {'aria-label': 'Download file'})
|
||||||
dl_url = info.get('href')
|
dl_url = info.get('href')
|
||||||
|
|
@ -188,7 +188,7 @@ def osdn(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*osdn\.net\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*osdn\.net\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No OSDN links found`\n")
|
raise DirectDownloadLinkException("No OSDN links found\n")
|
||||||
page = BeautifulSoup(
|
page = BeautifulSoup(
|
||||||
requests.get(link, allow_redirects=True).content, 'lxml')
|
requests.get(link, allow_redirects=True).content, 'lxml')
|
||||||
info = page.find('a', {'class': 'mirror_link'})
|
info = page.find('a', {'class': 'mirror_link'})
|
||||||
|
|
@ -206,13 +206,13 @@ def github(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
re.findall(r'\bhttps?://.*github\.com.*releases\S+', url)[0]
|
re.findall(r'\bhttps?://.*github\.com.*releases\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No GitHub Releases links found`\n")
|
raise DirectDownloadLinkException("No GitHub Releases links found\n")
|
||||||
download = requests.get(url, stream=True, allow_redirects=False)
|
download = requests.get(url, stream=True, allow_redirects=False)
|
||||||
try:
|
try:
|
||||||
dl_url = download.headers["location"]
|
dl_url = download.headers["location"]
|
||||||
return dl_url
|
return dl_url
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise DirectDownloadLinkException("`Error: Can't extract the link`\n")
|
raise DirectDownloadLinkException("Error: Can't extract the link\n")
|
||||||
|
|
||||||
|
|
||||||
def hxfile(url: str) -> str:
|
def hxfile(url: str) -> str:
|
||||||
|
|
@ -222,7 +222,7 @@ def hxfile(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*hxfile\.co\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*hxfile\.co\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No Hxfile links found`\n")
|
raise DirectDownloadLinkException("No Hxfile links found\n")
|
||||||
bypasser = lk21.Bypass()
|
bypasser = lk21.Bypass()
|
||||||
dl_url=bypasser.bypass_url(link)
|
dl_url=bypasser.bypass_url(link)
|
||||||
return dl_url
|
return dl_url
|
||||||
|
|
@ -235,7 +235,7 @@ def anon(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*anonfiles\.com\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*anonfiles\.com\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No Anonfiles links found`\n")
|
raise DirectDownloadLinkException("No Anonfiles links found\n")
|
||||||
bypasser = lk21.Bypass()
|
bypasser = lk21.Bypass()
|
||||||
dl_url=bypasser.bypass_url(link)
|
dl_url=bypasser.bypass_url(link)
|
||||||
return dl_url
|
return dl_url
|
||||||
|
|
@ -248,7 +248,7 @@ def letsupload(url: str) -> str:
|
||||||
try:
|
try:
|
||||||
link = re.findall(r'\bhttps?://.*letsupload\.io\S+', url)[0]
|
link = re.findall(r'\bhttps?://.*letsupload\.io\S+', url)[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise DirectDownloadLinkException("`No Letsupload links found`\n")
|
raise DirectDownloadLinkException("No Letsupload links found\n")
|
||||||
bypasser = lk21.Bypass()
|
bypasser = lk21.Bypass()
|
||||||
dl_url=bypasser.bypass_url(link)
|
dl_url=bypasser.bypass_url(link)
|
||||||
return dl_url
|
return dl_url
|
||||||
|
|
@ -286,7 +286,7 @@ def onedrive(link: str) -> str:
|
||||||
direct_link1 = f"https://api.onedrive.com/v1.0/shares/u!{direct_link_encoded}/root/content"
|
direct_link1 = f"https://api.onedrive.com/v1.0/shares/u!{direct_link_encoded}/root/content"
|
||||||
resp = requests.head(direct_link1)
|
resp = requests.head(direct_link1)
|
||||||
if resp.status_code != 302:
|
if resp.status_code != 302:
|
||||||
return "`Error: Unauthorized link, the link may be private`"
|
return "Error: Unauthorized link, the link may be private"
|
||||||
dl_link = resp.next.url
|
dl_link = resp.next.url
|
||||||
file_name = dl_link.rsplit("/", 1)[1]
|
file_name = dl_link.rsplit("/", 1)[1]
|
||||||
resp2 = requests.head(dl_link)
|
resp2 = requests.head(dl_link)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue