v4.4.4 (#35)
- cc after clone finish. Thanks to anasty17 - Change to yt-dlp
This commit is contained in:
parent
8610fec2ba
commit
1a222a3cfc
|
|
@ -1,7 +1,7 @@
|
|||
[](https://youtu.be/Pk_TthHfLeE)
|
||||
|
||||
# Slam Mirror Bot
|
||||
This is a telegram bot writen in python for mirroring files on the internet to our beloved Google Drive. This project is heavily inspired from @out386 's telegram bot which is written in JS.
|
||||
This is a telegram bot writen in python for mirroring files on the internet to our beloved Google Drive.
|
||||
|
||||
## How to deploy?
|
||||
Deploying is pretty much straight forward and is divided into several steps as follows:
|
||||
|
|
@ -170,6 +170,7 @@ where host is the name of extractor (eg. youtube, twitch). Multiple accounts of
|
|||
## Credits
|
||||
|
||||
Thanks to:
|
||||
- [out386](https://github.com/out386) heavily inspired from telegram bot which is written in JS.
|
||||
- [Izzy12](https://github.com/lzzy12/) for original repo
|
||||
- [Dank-del](https://github.com/Dank-del/) for base repo
|
||||
- [magneto261290](https://github.com/magneto261290/) for some features
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from .download_helper import DownloadHelper
|
||||
import time
|
||||
from youtube_dl import YoutubeDL, DownloadError
|
||||
from yt_dlp import YoutubeDL, DownloadError
|
||||
from bot import download_dict_lock, download_dict
|
||||
from ..status_utils.youtube_dl_download_status import YoutubeDLDownloadStatus
|
||||
import logging
|
||||
|
|
|
|||
|
|
@ -269,7 +269,10 @@ class GoogleDriveHelper:
|
|||
if err.resp.get('content-type', '').startswith('application/json'):
|
||||
reason = json.loads(err.content).get('error').get('errors')[0].get('reason')
|
||||
if reason == 'userRateLimitExceeded' or reason == 'dailyLimitExceeded':
|
||||
raise err
|
||||
if USE_SERVICE_ACCOUNTS:
|
||||
self.switchServiceAccount()
|
||||
LOGGER.info(f"Got: {reason}, Trying Again.")
|
||||
return self.copyFile(file_id,dest_id)
|
||||
else:
|
||||
raise err
|
||||
|
||||
|
|
@ -368,13 +371,7 @@ class GoogleDriveHelper:
|
|||
err = err.last_attempt.exception()
|
||||
err = str(err).replace('>', '').replace('<', '')
|
||||
LOGGER.error(err)
|
||||
if "User rate limit exceeded" in str(err):
|
||||
msg = "User rate limit exceeded."
|
||||
elif "File not found" in str(err):
|
||||
msg = "File not found."
|
||||
else:
|
||||
msg = f"Error.\n{err}"
|
||||
return msg, ""
|
||||
return err, ""
|
||||
return msg, InlineKeyboardMarkup(buttons.build_menu(2))
|
||||
|
||||
def cloneFolder(self, name, local_path, folder_id, parent_id):
|
||||
|
|
|
|||
|
|
@ -4,33 +4,28 @@ from bot.helper.telegram_helper.message_utils import *
|
|||
from bot.helper.telegram_helper.filters import CustomFilters
|
||||
from bot.helper.telegram_helper.bot_commands import BotCommands
|
||||
from bot.helper.ext_utils.bot_utils import new_thread
|
||||
from bot import dispatcher, LOGGER
|
||||
from bot import dispatcher
|
||||
|
||||
|
||||
@new_thread
|
||||
def cloneNode(update,context):
|
||||
if update.message.from_user.last_name:
|
||||
last_name = f" {update.message.from_user.last_name}"
|
||||
else:
|
||||
last_name = ""
|
||||
if update.message.from_user.username:
|
||||
username = f"@{update.message.from_user.username}"
|
||||
else:
|
||||
username = ""
|
||||
name = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}{last_name}</a>'
|
||||
|
||||
args = update.message.text.split(" ",maxsplit=1)
|
||||
if update.message.from_user.username:
|
||||
uname = f"@{update.message.from_user.username}"
|
||||
else:
|
||||
uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
|
||||
if uname is not None:
|
||||
cc = f'\n\ncc: {uname}'
|
||||
if len(args) > 1:
|
||||
link = args[1]
|
||||
msg = f'Cloning...\n' \
|
||||
f'User: {username}\n' \
|
||||
f'Link: <a href="{link}">{link}</a>'
|
||||
sendMessage(msg, context.bot, update)
|
||||
msg = sendMessage(f"Cloning: <code>{link}</code>",context.bot,update)
|
||||
gd = GoogleDriveHelper()
|
||||
result, button = gd.clone(link)
|
||||
LOGGER.info('ID: {} - Username: {} - Message: {}'.format(update.message.chat.id,update.message.chat.username,update.message.text))
|
||||
# deleteMessage(context.bot,msg)
|
||||
sendMarkup(result,context.bot,update,button)
|
||||
deleteMessage(context.bot,msg)
|
||||
if button == "":
|
||||
sendMessage(result,context.bot,update)
|
||||
else:
|
||||
sendMarkup(result + cc,context.bot,update,button)
|
||||
else:
|
||||
sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ python-magic
|
|||
beautifulsoup4>=4.8.2,<4.8.10
|
||||
pyrogram
|
||||
TgCrypto
|
||||
youtube_dl
|
||||
yt-dlp
|
||||
feedparser
|
||||
natsort
|
||||
heroku3
|
||||
|
|
|
|||
Loading…
Reference in New Issue