Questions tagged [telethon]

Telethon is a Python 3 Telegram client library. It uses the normal Telegram API instead of the Bot API, which means it can perform all actions a regular user can perform. Use this tag when asking questions about using the Telethon library.

Python 3 Telegram client library which is used API of Telegram.

Home page: https://pypi.python.org/pypi/Telethon

1211 questions
6
votes
2 answers

How to search for groups and channel in telegram using telethon?

I use telethon for sending messages to telegram using python script. I did not find anything in telethon to search for groups and channels I like used to search on telegram app. Please see iamge. How can I get such list using telethon?
Alok
  • 7,734
  • 8
  • 55
  • 100
6
votes
0 answers

Trying to stream telegram media and playing it in a web page

I am trying to stream Telegram video files and play them on a web page. I am using this script to stream Telegram videos to a web server. It uses Telethon and AIOhttp to stream the file. The streaming part can be seen here. I am currently serving…
Prashant Sengar
  • 506
  • 1
  • 7
  • 24
6
votes
6 answers

Telethon: OperationalError: database is locked

Apologies if it is a silly question. I am trying telethon for the first time and it fails to synchronize with my telegram API. I get an IP address when I type this code: But I get this message when I try to connect to start or connect the…
J.Doe
  • 353
  • 1
  • 2
  • 12
6
votes
1 answer

How to add Millions of contacts to telegram?

My goal is to add 10M contacts to telegram. How can we add contacts to telegram using telegram API? I have tried using telethon in which I batched 500 contacts in one request. However, telegram responded all such requests with all contacts in…
Shreeya Patel
  • 125
  • 1
  • 1
  • 11
6
votes
1 answer

Telegram API throwing PeerFloodError: Too many requests

I am not using bot API. I am using Telegram API to send messages. Messages are being sent easily but the problem occurs after 19 users. On the 20th user, I receive PeerFloodError. Even after, searching a lot, I didn't find any specific limits and…
6
votes
3 answers

How to get telegram's channel description in Telethon?

I'm writing a client of telegram using Telethon. How can i get channel description? get_entity method does not provide channel description.
Cierra Clark
  • 107
  • 2
  • 7
6
votes
2 answers

invite user by username to telegram channel

i trying to add users by usernames to my channel. I am using python 3.6 telethon library and pythonanywhere server: api_hash = 'b7**' phone = '+7***' client = TelegramClient('new_ses', api_id, api_hash) client.connect() client =…
egorkh
  • 478
  • 8
  • 24
6
votes
1 answer

How to download a video using telethon

I'm working on telethon download_media and _download_document methods for downloading video from telegram. My code is something like this: def callback(update): Channel_Entity = client.get_entity(Channel_List) #Get specific Channel…
smart-developer
  • 195
  • 1
  • 3
  • 14
6
votes
3 answers

Telegram channel- how to get access_hash?

I try really hard to understand howto use Telegram api with telethon. I have some Channels in Telegram, where i want to delete older Messages. Using inputpeerchannel() i need channel_id (No Problem) and channel_hash. I cant findout howto get this…
Fritz Maier
  • 71
  • 1
  • 1
  • 2
6
votes
2 answers

How i can add my contact in my channel with telethon API python

this is info my channel : dialogs, entities = client.get_dialogs(1) entity = entities[0] print(entity) (channel (ID: 0xa14dca52) = (creator=True, kicked=None, left=None, editor=None, moderator=None, broadcast=True, verified=None, megagroup=None,…
netdevil
  • 309
  • 1
  • 7
  • 18
5
votes
3 answers

How to login manually to telegram account with pyrogram without interactive console

I'm using Python's pyrogram lib to login to multiple accounts. I need to create a function just to send verification code to account and then read it from other user input (not the default pyrogram login prompt). When I use send_code it sends code…
Khalil Abbas
  • 110
  • 2
  • 7
5
votes
1 answer

How to create an asyncio task that return value?

I'm figuring out how to return a list[] in asyncio I know asyncio.gather could help me but there are so many ways I'm now confused. How Do I return value from main() ? Thank async def wait_until(dt): # sleep until the specified datetime now…
user14857172
5
votes
2 answers

How to get only unread messages from chat using telethon?

I have client.get_messages(dialog.entity) but its return just messages without "read/unread mark"... So, how can I get unread new messages only? Anybody know?
EightShift
  • 71
  • 1
  • 5
5
votes
1 answer

How to download images to my local PC using telethon

I have seen all the entries asking about telethon but none answer my question. WHAT TO I WANT TO ACHIEVE? I want to download an image from a telegram channel into my PC WHAT HAVE I DONE SO FAR? I am able to create a client and to read the message…
Migui Mag
  • 187
  • 1
  • 3
  • 13
5
votes
3 answers

When starting client the code is asking for phone/bot token

While running my first code using Telethon library, it is asking for a bot token. This is the actual code: from telethon import TelegramClient, events, sync api_id = 1234567 api_hash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' client =…
Aneesh M
  • 53
  • 1
  • 1
  • 4
1
2
3
80 81