• XSS.stack #1 – первый литературный журнал от юзеров форума

Есть ли способ сгружать файлы с tg на мегу без локального скачивания ?

I dont know too much about this, but time ago I heard about a bot that, supposedly, upload files to mega: @megauploadxbot
Im not tested and I dont know if it works as expected (im not usually use mega service).
I hope that it can to be helpful and works fine :)
 
Пожалуйста, обратите внимание, что пользователь заблокирован
i have the simple bot script from the 19 year

you can try:

Скрытый контент для зарегистрированных пользователей.

Код:
from telethon.sync import TelegramClient, events
from mega import Mega
import random

api_id = ''
api_hash = ''
bot_token = ''


mega_email = ''
mega_password = ''

mega = Mega()
m = mega.login(mega_email, mega_password)

client = TelegramClient('session_name', api_id, api_hash).start(bot_token=bot_token)

channels_to_monitor = set()

@client.on(events.NewMessage(pattern='/start'))
async def start(event):
    await event.respond('Bot started. Use /add_channel to add channels/groups for file upload.')

@client.on(events.NewMessage(pattern='/add_channel'))
async def add_channel(event):
    await event.respond('Enter the username of the channel/group you want to monitor:')
    channels_to_monitor.add(event.sender_id)

@client.on(events.NewMessage)
async def handle_new_message(event):
    if event.sender_id in channels_to_monitor and event.media:
        try:
            if event.media.document.size <= 1024 * 1024 * 1024: # Check if file size is <= 20 GB
                input_location = await event.download_media(bytes)
                account_info = m.get_user()
                storage_info = account_info['storage']
                used_storage = storage_info['used']
                total_storage = storage_info['max']

                if used_storage + event.media.document.size < total_storage:
                    file_path = m.upload(input_location)
                    await event.respond(f"File successfully uploaded to Mega: {file_path}")
                else:
                    await event.respond("Insufficient storage space in Mega account.")
            else:
                await event.respond("File size exceeds the limit (20 GB) and cannot be uploaded!.")
        except Exception as e:
            print(f"Error uploading file: {e}")
            await event.respond("Error uploading file. Please try again later.")

with client:
    client.run_until_disconnected()


wrote it.
 
Последнее редактирование:
Пожалуйста, обратите внимание, что пользователь заблокирован
you can execute that on any vps you have run until its end.
 
Подскажите как быть : нужно большие объемы архивов с TG переложить на мегу , без локального скачивания. Возможно ли такое ?
Скачивать в любом случае придется. Вопрос только куда? Это может быть сервер, который скачивает через скрипт по API файлы с телеграм и грузит их на мегу. Качать он может частями: загружать в память, либо сохранять на диск во временную папку. В этом случае нужны API-ключи для телеграм и Mega. Ну либо ручками качать и заливать.
Напрямую с телеграм в мегу - нет способа.
 
Пожалуйста, обратите внимание, что пользователь заблокирован
it is designed to create a telegram bot that interacts with Telegram channels or groups and uploads files found in those channels/groups(this could be logs only on your part) directly to a Mega account. There's no direct user interaction required during the file transfer process
you can execute that on any vps you have run until its end.
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх