codesafety_x11repo

Untitled

Apr 27th, 2020
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.94 KB | None | 0 0
  1. import vk_api
  2. from bs4 import BeautifulSoup
  3. import requests
  4. import time
  5.  
  6. print("Создано x11repo\n\nМои контакты:\nTelegram: https://teleg.run/alxxxnd\n")
  7.  
  8. token = ""  # Сюда вставляем токен
  9. country = "it"  # Страны: ru - РОССИЯ, cn - КИТАЙ, en - США, it - ИТАЛИЯ
  10. change_country = 60  # ВРЕМЯ В СЕКУНДАХ ЗА КОТОРОЕ 'Весь Мир' сменится на страну которую вы указали в country   #НЕ СТАВИТЬ МЕНЬШЕ 60 СЕКУНД!!!
  11.  
  12.  
  13. def coronavirus_info():
  14.     HEADERS = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"}
  15.     session = requests.Session()
  16.     text = session.get("https://news.google.com/covid19/map?hl=ru&gl=RU&ceid=RU:ru", headers=HEADERS).content
  17.     bs = BeautifulSoup(text, "html.parser")
  18.     all = bs.find_all("td", class_="l3HOY")
  19.  
  20.     return all[1], all[3], all[4], all[86], all[88], all[89], all[31], all[33], all[34], all[6], all[8], all[9], all[16],all[18], all[19]
  21.  
  22.  
  23. def main():
  24.     vk_session = vk_api.VkApi(token=token)
  25.     vk = vk_session.get_api()
  26.     vk.status.set(text="Весь Мир: Всего заболевших: " + str(info[0].text) + ".‍ Выздоровело: " + str(
  27.         info[1].text) + ". Летальные исходы: " + str(info[2].text) + ". Время: " + time.strftime("%H:%M"))
  28.     time.sleep(change_country)
  29.     if country == "ru":
  30.         vk.status.set(text="Россия: Всего заболевших: " + str(info[3].text) + ".‍ Выздоровело: " + str(
  31.             info[4].text) + ". Летальные исходы: " + str(info[5].text) + ". Время: " + time.strftime(
  32.             "%H:%M"))
  33.     elif country == "cn":
  34.         vk.status.set(text="Китай: Всего заболевших: " + str(info[6].text) + ".‍ Выздоровело: " + str(
  35.             info[7].text) + ". Летальные исходы: " + str(info[8].text) + ". Время: " + time.strftime("%H:%M"))
  36.     elif country == "en":
  37.         vk.status.set(text="США: Всего заболевших: " + str(info[9].text) + ".‍ Выздоровело: " + str(
  38.             info[10].text) + ". Летальные исходы: " + str(info[11].text) + ". Время: " + time.strftime(
  39.             "%H:%M"))
  40.     elif country == "it":
  41.         vk.status.set(text="Италия: Всего заболевших: " + str(info[12].text) + ".‍ Выздоровело: " + str(
  42.             info[13].text) + ". Летальные исходы: " + str(info[14].text) + ". Время: " + time.strftime(
  43.             "%H:%M"))
  44.     else:
  45.         pass
  46.     time.sleep(change_country)
  47.  
  48.  
  49. while True:
  50.     try:
  51.         info = coronavirus_info()
  52.         main()
  53.     except:
  54.         print("Ошибка!\nОтпишите мне по контактам для того чтобы я пофиксил!")
Advertisement
Add Comment
Please, Sign In to add comment