Skip to content

[Bug]: 新版本问题 #69

Closed
Closed
@jerryc127

Description

@jerryc127

telegram_media_downloader version or commit

2.1.8

What OS are you seeing the problem on?

Other Linux Distro

Python Version

No response

What happened?

运行 python3 media_downloader.py

A 账号注册的 bot,api_hash,api_id

用 A 账号电话登录

用 A 账号转发东西到 bot, 都是 Skipped, 没有下载。
用 B 账号转发东西到 bot,log 报错

2023-05-12 00:48:21.079 | ERROR    | __main__:worker:485 - Telegram says: [400 PEER_ID_INVALID] - The peer id being used is invalid or not known yet. Make sure you meet the peer before interacting with it 
Traceback (most recent call last):

  File "/usr/local/lib/python3.10/dist-packages/pyrogram/methods/advanced/resolve_peer.py", line 62, in resolve_peer
    return await self.storage.get_peer_by_id(peer_id)
                 │    │       │              └ 5415771761
                 │    │       └ <function SQLiteStorage.get_peer_by_id at 0xffffb3035c60>
                 │    └ <pyrogram.storage.file_storage.FileStorage object at 0xffffb22a2260>
                 └ <pyrogram.client.Client object at 0xffffb2a3da80>
  File "/usr/local/lib/python3.10/dist-packages/pyrogram/storage/sqlite_storage.py", line 148, in get_peer_by_id
    raise KeyError(f"ID not found: {peer_id}")

KeyError: 'ID not found: 5415771761'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/usr/local/lib/python3.10/dist-packages/pyrogram/methods/advanced/resolve_peer.py", line 123, in resolve_peer
    return await self.storage.get_peer_by_id(peer_id)
                 │    │       │              └ 5415771761
                 │    │       └ <function SQLiteStorage.get_peer_by_id at 0xffffb3035c60>
                 │    └ <pyrogram.storage.file_storage.FileStorage object at 0xffffb22a2260>
                 └ <pyrogram.client.Client object at 0xffffb2a3da80>
  File "/usr/local/lib/python3.10/dist-packages/pyrogram/storage/sqlite_storage.py", line 148, in get_peer_by_id
    raise KeyError(f"ID not found: {peer_id}")

KeyError: 'ID not found: 5415771761'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/root/telegram_media_downloader/media_downloader.py", line 624, in <module>
    main()
    └ <function main at 0xffffb229e5f0>

  File "/root/telegram_media_downloader/media_downloader.py", line 598, in main
    _exec_loop()
    └ <function _exec_loop at 0xffffb229e4d0>

  File "/root/telegram_media_downloader/media_downloader.py", line 563, in _exec_loop
    app.loop.run_forever()
    │   │    └ <function BaseEventLoop.run_forever at 0xffffb4345990>
    │   └ <_UnixSelectorEventLoop running=True closed=False debug=False>
    └ <module.app.Application object at 0xffffb22a09a0>

  File "/usr/lib/python3.10/asyncio/base_events.py", line 600, in run_forever
    self._run_once()
    │    └ <function BaseEventLoop._run_once at 0xffffb4347490>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1896, in _run_once
    handle._run()
    │      └ <function Handle._run at 0xffffb44f6ef0>
    └ <Handle Task.task_wakeup(<Future finished result=None>)>
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    │    │            │    │           │    └ <member '_args' of 'Handle' objects>
    │    │            │    │           └ <Handle Task.task_wakeup(<Future finished result=None>)>
    │    │            │    └ <member '_callback' of 'Handle' objects>
    │    │            └ <Handle Task.task_wakeup(<Future finished result=None>)>
    │    └ <member '_context' of 'Handle' objects>
    └ <Handle Task.task_wakeup(<Future finished result=None>)>

> File "/root/telegram_media_downloader/media_downloader.py", line 483, in worker
    await download_task(client, message, node)
          │             │       │        └ <module.app.TaskNode object at 0xffffb10c78e0>
          │             │       └ pyrogram.types.Message(id=672, from_user=pyrogram.types.User(id=5415771761, is_self=False, is_contact=False, is_mutual_contac...
          │             └ <pyrogram.client.Client object at 0xffffb2a3da80>
          └ <function download_task at 0xffffb229e050>

  File "/root/telegram_media_downloader/media_downloader.py", line 271, in download_task
    download_status, file_name = await download_media(
                                       └ <function download_media at 0xffffb229de10>

  File "/root/telegram_media_downloader/module/pyrogram_extension.py", line 329, in inner
    status, file_name = await func(
                              └ <function download_media at 0xffffb229e3b0>

  File "/root/telegram_media_downloader/media_downloader.py", line 356, in download_media
    message = await fetch_message(client, message)
                    │             │       └ pyrogram.types.Message(id=672, from_user=pyrogram.types.User(id=5415771761, is_self=False, is_contact=False, is_mutual_contac...
                    │             └ <pyrogram.client.Client object at 0xffffb2a3da80>
                    └ <function fetch_message at 0xffffb28eee60>

  File "/root/telegram_media_downloader/module/pyrogram_extension.py", line 482, in fetch_message
    return await client.get_messages(
                 │      └ <function GetMessages.get_messages at 0xffffb30e95a0>
                 └ <pyrogram.client.Client object at 0xffffb2a3da80>

  File "/usr/local/lib/python3.10/dist-packages/pyrogram/methods/messages/get_messages.py", line 101, in get_messages
    peer = await self.resolve_peer(chat_id)
                 │    │            └ 5415771761
                 │    └ <function ResolvePeer.resolve_peer at 0xffffb30eab00>
                 └ <pyrogram.client.Client object at 0xffffb2a3da80>
  File "/usr/local/lib/python3.10/dist-packages/pyrogram/methods/advanced/resolve_peer.py", line 125, in resolve_peer
    raise PeerIdInvalid
          └ <class 'pyrogram.errors.exceptions.bad_request_400.PeerIdInvalid'>

pyrogram.errors.exceptions.bad_request_400.PeerIdInvalid: Telegram says: [400 PEER_ID_INVALID] - The peer id being used is invalid or not known yet. Make sure you meet the peer before interacting with it 
  1. 用 b 账号手机登录
    b 账号转发东西到 Bot, 有些 Skipped,有些能下载,但是下载下来的东西不是我转发的,是之前的转发的内容
    a 账号转发东西到 bot, log 报错,跟上面的一样

Expected Behavior

一些正常

上一个版本
无论哪个账号登陆
哪个账号转发到 Bot
一切正常下载

Current Behavior

.

Possible Solution

No response

Steps to Reproduce

No response

Relevant log output

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

  • Status

    In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions