Skip to content

Commit

Permalink
v4.8.6
Browse files Browse the repository at this point in the history
- direct_link_generator: add letsupload.io, feurl.com, pixeldrain.com support
- Block Drive & YouTube link using /mirror command
- Remove racaty.net because have firewall
- Remove anime & stickers module, because not related in mirror bot
- Some update in aria.sh
- Tidying Up

NOTE: Redeploy Recommended.

Co-authored-by: Ncode2014 <[email protected]>
Co-authored-by: FA Tulloh <[email protected]>
  • Loading branch information
3 people authored Jun 14, 2021
1 parent 90b9c45 commit a013248
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 750 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
- Custom image support
- Counting file/folder
- Shell and Executor
- Stickers module
- View Link button
- Direct links supported:
```
racaty.net, hxfile.co, anonfiles.com, fembed.com, femax20.com, layarkacaxxi.icu,
letsupload.io, 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),
feurl.com, pixeldrain.com, uptobox.com (Uptobox account must be premium),
1drv.ms (Only works for file not folder or busines account)
```
## From Original Repos
Expand Down Expand Up @@ -104,7 +103,7 @@ pip3 install -r requirements-cli.txt
**2. Using Heroku PostgreSQL**
<p><a href="https://dev.to/prisma/how-to-setup-a-free-postgresql-database-on-heroku-1dc1"> <img src="https://img.shields.io/badge/see%20on%20dev.to-black?style=for-the-badge&logo=dev-dot-to" width="190""/></a></p>

**NOTE**: If you deploying on Heroku, no need to generate database manually, because it will automatic generate database when first deploying
**NOTE**: If you deploying on Heroku using Heroku button, no need to generate database manually, because it will automatic generate database when first deploying

</details>

Expand All @@ -125,7 +124,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **TELEGRAM_API**: This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes.
- **TELEGRAM_HASH**: This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org
- **OWNER_ID**: The Telegram user ID (not username) of the Owner of the bot
- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-mirrorbot/tree/master#generate-database) to generate database. (**NOTE**: If you deploying on Heroku, no need to generate database manually, because it will automatic generate database when first deploying)
- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-mirrorbot/tree/master#generate-database) to generate database. (**NOTE**: If you deploying on Heroku using Heroku button, no need to generate database manually, because it will automatic generate database when first deploying)
- **GDRIVE_FOLDER_ID**: This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors.
- **DOWNLOAD_DIR**: The path to the local folder where the downloads should be downloaded to
- **DOWNLOAD_STATUS_UPDATE_INTERVAL**: A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it `5` seconds at least)
Expand Down Expand Up @@ -214,7 +213,7 @@ sudo docker run mirrorbot
## Deploying on Heroku with heroku-cli and Goorm IDE
<p><a href="https://telegra.ph/How-to-Deploy-a-Mirror-Bot-to-Heroku-with-CLI-05-06"> <img src="https://img.shields.io/badge/see%20on%20telegraph-grey?style=for-the-badge" width="190""/></a></p>

## Video Tutorial
## Video Tutorial deploying slam-mirrorbot on Heroku
<p><a href="https://www.youtube.com/watch?v=WIhL0TrisfQ&t=1s"> <img src="https://img.shields.io/badge/See%20On%20Youtube-black?style=for-the-badge&logo=youtube" width="200""/></a></p>

**NOTE**: Recommended to generate **token.pickle** manually. [Read here](https://github.com/breakdowns/slam-mirrorbot#getting-google-oauth-api-credential-file)
Expand Down Expand Up @@ -304,5 +303,6 @@ Thanks to:
- [magneto261290](https://github.com/magneto261290/) for some features
- [SVR666](https://github.com/SVR666/) for some features & fixes
- [anasty17](https://github.com/anasty17) for some features & help
- [breakdowns](https://github.com/breakdowns) for Slam

And many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/breakdowns/slam-mirrorbot/graphs/contributors).
4 changes: 2 additions & 2 deletions aria.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export MAX_DOWNLOAD_SPEED=0
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' ',')
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' ',')
export MAX_CONCURRENT_DOWNLOADS=7

aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false \
Expand All @@ -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=-qB4350- --user-agent=qBittorrent/4.3.5 --peer-agent=qBittorrent/4.3.5 \
--peer-id-prefix=-TR3000- --peer-agent=Transmission/3.00 \
--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
14 changes: 3 additions & 11 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .helper.ext_utils.bot_utils import get_readable_file_size, get_readable_time
from .helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper import button_build
from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, shell, eval, anime, stickers, search, delete, speedtest, usage, mediainfo, count
from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, shell, eval, search, delete, speedtest, usage, mediainfo, count

now=datetime.now(pytz.timezone('Asia/Jakarta'))

Expand Down Expand Up @@ -58,9 +58,10 @@ def start(update, context):
buttons.buildbutton("Support Group", "https://t.me/SlamMirrorSupport")
reply_markup = InlineKeyboardMarkup(buttons.build_menu(2))
LOGGER.info('UID: {} - UN: {} - MSG: {}'.format(update.message.chat.id, update.message.chat.username, update.message.text))
uptime = get_readable_time((time.time() - botStartTime))
if CustomFilters.authorized_user(update) or CustomFilters.authorized_chat(update):
if update.message.chat.type == "private" :
sendMessage(f"Hey I'm Alive 🙂", context.bot, update)
sendMessage(f"Hey I'm Alive 🙂\nSince: <code>{uptime}</code>", context.bot, update)
else :
update.effective_message.reply_photo(IMAGE_URL, start_string, parse_mode=ParseMode.MARKDOWN, reply_markup=reply_markup)
else :
Expand All @@ -69,7 +70,6 @@ def start(update, context):

def restart(update, context):
restart_message = sendMessage("Restarting, Please wait!", context.bot, update)
LOGGER.info(f'Restarting the Bot...')
# Save restart message object in order to reply to it after restarting
with open(".restartmsg", "w") as f:
f.truncate(0)
Expand Down Expand Up @@ -138,10 +138,6 @@ def bot_help(update, context):
/mediainfo: Get detailed info about replied media (Only for Telegram file).
/tshelp: Get help for Torrent search module.
/weebhelp: Get help for Anime, Manga, and Character module.
/stickerhelp: Get help for Stickers module.
'''

help_string = f'''
Expand Down Expand Up @@ -174,10 +170,6 @@ def bot_help(update, context):
/mediainfo: Get detailed info about replied media (Only for Telegram file).
/tshelp: Get help for Torrent search module.
/weebhelp: Get help for Anime, Manga, and Character module.
/stickerhelp: Get help for Stickers module.
'''

if CustomFilters.sudo_user(update) or CustomFilters.owner_filter(update):
Expand Down
64 changes: 43 additions & 21 deletions bot/helper/mirror_utils/download_utils/direct_link_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@
from js2py import EvalJs
from lk21.extractors.bypasser import Bypass
from base64 import standard_b64encode

from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException


def direct_link_generator(link: str):
""" direct links generator """
if not link:
raise DirectDownloadLinkException("`No links found!`")
elif 'youtube.com' in link or 'youtu.be' in link:
raise DirectDownloadLinkException(f"Youtube Link use /{BotCommands.WatchCommand} or /{BotCommands.TarWatchCommand}")
elif 'drive.google.com' in link:
raise DirectDownloadLinkException(f"G-Drive Link use /{BotCommands.CloneCommand}")
elif 'zippyshare.com' in link:
return zippy_share(link)
elif 'yadi.sk' in link:
Expand All @@ -46,16 +50,18 @@ def direct_link_generator(link: str):
return osdn(link)
elif 'github.com' in link:
return github(link)
elif 'racaty.net' in link:
return racaty(link)
elif 'hxfile.co' in link:
return hxfile(link)
elif 'anonfiles.com' in link:
return anon(link)
elif 'letsupload.io' in link:
return letsupload(link)
elif 'fembed.com' in link:
return fembed(link)
elif 'femax20.com' in link:
return fembed(link)
elif 'feurl.com' in link:
return fembed(link)
elif 'naniplay.nanime.in' in link:
return fembed(link)
elif 'naniplay.nanime.biz' in link:
Expand All @@ -70,11 +76,15 @@ def direct_link_generator(link: str):
return sbembed(link)
elif '1drv.ms' in link:
return onedrive(link)
elif 'pixeldrain.com' in link:
return pixeldrain(link)
else:
raise DirectDownloadLinkException(f'No Direct link function found for {link}')


def zippy_share(url: str) -> str:
""" ZippyShare direct links generator
Based on https://github.com/KenHV/Mirror-Bot """
link = re.findall("https:/.(.*?).zippyshare", url)[0]
response_content = (requests.get(url)).content
bs_obj = BeautifulSoup(response_content, "lxml")
Expand Down Expand Up @@ -203,24 +213,6 @@ def github(url: str) -> str:
raise DirectDownloadLinkException("`Error: Can't extract the link`\n")


def racaty(url: str) -> str:
""" Racaty direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*racaty\.net\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("`No Racaty links found`\n")
reqs=requests.get(link)
bss=BeautifulSoup(reqs.text,'html.parser')
op=bss.find('input',{'name':'op'})['value']
id=bss.find('input',{'name':'id'})['value']
rep=requests.post(link,data={'op':op,'id':id})
bss2=BeautifulSoup(rep.text,'html.parser')
dl_url=bss2.find('a',{'id':'uniqueExpirylink'})['href']
return dl_url


def hxfile(url: str) -> str:
""" Hxfile direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
Expand All @@ -247,6 +239,19 @@ def anon(url: str) -> str:
return dl_url


def letsupload(url: str) -> str:
""" Letsupload direct link generator
Based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*letsupload\.io\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("`No Letsupload links found`\n")
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_url(link)
return dl_url


def fembed(link: str) -> str:
""" Fembed direct link generator
Based on https://github.com/breakdowns/slam-mirrorbot """
Expand All @@ -257,6 +262,8 @@ def fembed(link: str) -> str:
for i in dl_url:
lst_link.append(dl_url[i])
return lst_link[count-1]
except:
raise DirectDownloadLinkException("ERROR: Can't download file, double check your Fembed link.")


def sbembed(link: str) -> str:
Expand All @@ -269,6 +276,8 @@ def sbembed(link: str) -> str:
for i in dl_url:
lst_link.append(dl_url[i])
return lst_link[count-1]
except:
raise DirectDownloadLinkException("ERROR: Can't download file, double check your Sbembed/Streamsb link.")


def onedrive(link: str) -> str:
Expand All @@ -286,6 +295,19 @@ def onedrive(link: str) -> str:
return dl_link


def pixeldrain(url: str) -> str:
""" Based on https://github.com/yash-dk/TorToolkit-Telegram """
url = url.strip("/ ")
file_id = url.split("/")[-1]
info_link = f"https://pixeldrain.com/api/file/{file_id}/info"
dl_link = f"https://pixeldrain.com/api/file/{file_id}"
resp = requests.get(info_link).json()
if resp["success"]:
return dl_link
else:
raise DirectDownloadLinkException("ERROR: Cant't download due {}.".format(resp.text["value"]))


def useragent():
"""
useragent random setter
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/mirror_utils/upload_utils/gdriveTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
LOGGER = logging.getLogger(__name__)
logging.getLogger('googleapiclient.discovery').setLevel(logging.ERROR)
SERVICE_ACCOUNT_INDEX = 0
TELEGRAPHLIMIT = 95
TELEGRAPHLIMIT = 80

class GoogleDriveHelper:
def __init__(self, name=None, listener=None):
Expand Down
Loading

0 comments on commit a013248

Please sign in to comment.