#Python Code for CORONA Updates on Telegram
from bs4 import BeautifulSoup
import requests
import pandas as pd
x=[]
x1=[]
source=requests.get('https://www.worldometers.info/coronavirus/country/india/').text
soup=BeautifulSoup(source,'lxml')
z=soup.find_all('div',id='maincounter-wrap')
z1=soup.find_all('div',class_='maincounter-number')
for k in z:
y=k.h1.text
x.append(y)
for i in z1:
y1=i.span.text
x1.append(y1)
df=pd.DataFrame(x1,x,['Number'])
df.head()
import telegram
chat_id = 957639882
token_id = '1339570026:AAE39zN86JK6mxgAGpkJo876Mq75IQW5WZU'
def send(msg,chat_id=chat_id,token=token_id):
bot = telegram.Bot(token=token_id)
bot.sendMessage(chat_id=chat_id,text=msg)
send(f" Todays's Corona Update:\n{df}")
0 Comments:
Post a Comment