usrbinenv python3 provide the current worldwide covid19 statistics this data is being scrapped from https www worldometers infocoronavirus return a dict of current worldwide covid19 statistics usr bin env python3 provide the current worldwide covid 19 statistics this data is being scrapped from https www worldometers info coronavirus return a dict of current worldwide covid 19 statistics
import requests
from bs4 import BeautifulSoup


def world_covid19_stats(url: str = "https://www.worldometers.info/coronavirus") -> dict:
    
    soup = BeautifulSoup(requests.get(url).text, "html.parser")
    keys = soup.findAll("h1")
    values = soup.findAll("div", {"class": "maincounter-number"})
    keys += soup.findAll("span", {"class": "panel-title"})
    values += soup.findAll("div", {"class": "number-table-main"})
    return {key.text.strip(): value.text.strip() for key, value in zip(keys, values)}


if __name__ == "__main__":
    print("\033[1m COVID-19 Status of the World \033[0m\n")
    print("\n".join(f"{key}\n{value}" for key, value in world_covid19_stats().items()))