telegramtelethonpy-telegram-bot-apipyrogram

How do I scrape photos and videos with Pyrogram or Telethon?


How do I scrape photos or videos from a group on Telegram using either Pyrogram or Telethon? I know how to make a client and so forth, but not sure which functions to call (I have already read the documentation).

I want the videos as mp4 files, and photos as jpg or jpeg.


Solution

  • You can use Client.get_chat_history() in Pyrogram and use offset argument to get all messages. Then check if messages has video or photo and if they have it download it using Message.download().