-
Notifications
You must be signed in to change notification settings - Fork 0
/
tg.py
35 lines (28 loc) · 1 KB
/
tg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
from bs4 import BeautifulSoup as bs
def telegram(username):
try:
base_url = f"https://t.me/{username}"
r= requests.get(base_url).text
# print(r)
soup= bs(r,"lxml")
# print(soup.text)
members_count = soup.find("div",class_="tgme_page_extra").text.replace(" ","").split("members")[0]
# print(members_count)
channel_name = soup.find("div",class_="tgme_page_title").text.replace("\n","")
# print(channel_name)
description = soup.find("div",class_="tgme_page_description").text
# print(description)
dp = soup.find("img",class_="tgme_page_photo_image")['src']
# print(dp['src'])
#5cientist
#hanshir lukku
data ={}
data['name'] = channel_name
data['sub'] = members_count
data['description'] = description
data['image'] = dp
return data
except Exception as e:
return {"status":False,"error":e}
# telegram("Quranpadashala")