H
H
Hector Synchrome2021-06-04 13:49:27
Bots
Hector Synchrome, 2021-06-04 13:49:27

How can I open a chat link (python, telegram, telethon)?

I am writing a script that collects links to other bots from a bot (JamiBOT) , using the telethon library. JamieBOT in the message sends me a link (type 1) ' https://doge.click/bot/Gw39ou ' , when clicked, the browser opens and goes to another link (for example) (type 2) ' https://telegram.me/ kainutokenbot?start=r09912865970 ' and offer to open the cart app.
That is, JamieBOT gives me a link to another bot, but in order to start a dialogue with the second bot, I need to open the browser -> open the link -> go to another -> return to the cart .
In the conditions of the script, it is desirable to avoid these unnecessary actions. So I would like to know how it is possible to avoid these actions? Or how can you extract a link (type 2) from a link (type 1 ) ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
agent_2203, 2021-06-11
@MatewGreg

use selenium to open the browser and follow the link, there you can even solve the captcha if necessary using rucaptcha

S
soremix, 2021-06-04
@soremix

Send a request through the same requests, and take the location from the headers. In general

import requests
r = requests.get('https://doge.click/bot/Gw39ou', allow_redirects=False)
print(r.headers['location'])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question