apenasrr / clonechat

Clone all posts from the history of a Telegram Channel/Group to another Channel/Group.
MIT License
388 stars 98 forks source link

trying again... Due to: Telegram says: [400 MEDIA_CAPTION_TOO_LONG] - The media caption is too long (caused by "messages.SendMedia") #20

Open yakkobr opened 1 year ago

yakkobr commented 1 year ago

ao tentar clonar o conteudo de varios grupos ocorre essa mensagem

trying again... Due to: Telegram says: [400 MEDIA_CAPTION_TOO_LONG] - The media caption is too long (caused by "messages.SendMedia")

grupo: Courses - Online

matheusbach commented 1 year ago

continua sendo um problema para voce?

yakkobr commented 1 year ago

continua sendo um problema para voce?

Opa, infelizmente sim, tento realizar o clone de alguns grupos e simplesmente trava, desta forma não consigo clonar todos os grupso que preciso.

criei um .sh onde coloco varios clones, então quando da erro em 1 os proximos não são executados.

image
timgahmen commented 7 months ago

do you still have the problem? .....

I only solve it "quick and dirty for myself"..... i add for every filetype (here as example for type photo):

except Exception as e:
print(f"trying again... Due to: {e}")
tg.send_photo(
              chat_id=destination_chat,
              photo=photo_id,
              caption="",
          )**
        time.sleep(10)

important is: caption=""

TokyoghoulEs commented 3 weeks ago

def foward_video(message, destination_chat): caption = get_caption(message) video_id = message.video.file_id MAX_CAPTION_LENGTH = 1024 # Limitar el subtítulo a 1024 caracteres

# Verificar si el subtítulo es demasiado largo y acortarlo si es necesario
if len(caption) > MAX_CAPTION_LENGTH:
    caption = caption[:MAX_CAPTION_LENGTH]

try:
    tg.send_video(
        chat_id=destination_chat,
        video=video_id,
        caption=caption,
    )
    return
except FloodWait as e:
    print(f"..FloodWait {e.value} seconds..")
    time.sleep(e.value)
except Exception as e:
    print(f"trying again... Due to: {e}")
    time.sleep(10)

foward_video(message, destination_chat)