Skip to main content

Worldometer Scraping & API - Get world metrics from worldometers.info

Project description

Logo Worldometer - Scraping & API

PyPI - Status PyPI GitHub release (latest by date) Documentation Status License MIT

Index

About

Worldometer is a python module that collects data from worldometers.info and provides a simple and self-explanatory interface for using the data.

worldometers.info

Worldometer is run by an international team of developers, researchers, and volunteers with the goal of making world statistics available in a thought-provoking and time relevant format to a wide audience around the world. It is published by a small and independent digital media company based in the United States. We have no political, governmental, or corporate affiliation. Furthermore, we have no investors, donors, grants, or backers of any type. We are completely independent and self-financed through automated programmatic advertising sold in real time on multiple ad exchanges.

More info: worldometers.info/about

How it works?

[Adapted]: For the data, is elaborate instead a real-time estimate through a proprietary algorithm which processes the latest data and projections provided by the most reputable organizations and statistical offices in the world.

More info about data source: worldometers.info/sources

Install

First, create a directory and enter it:

$ mkdir my_project && cd my_project

Create a virtual environment to avoid breaking dependence on other projects.

This project uses pipenv, it already does it alone ;)

$ pipenv install worldometer

But you can use virtualenv + pip if you prefer:

$ virtualenv venv && source venv/Scripts/activate

Now install:

$ pip install worldometer

Demo

The first time you run any function/method or class, it will download Chromium to its home directory (for example, ~/.pyppeteer/). It only happens once.

After, it will only open the chromium to render the contents of worldometers.

Simple API usage:

>>> import worldometer

>>> worldometer.current_world_population()
{'current_world_population': 7845085923}

>>> worldometer.tweets_sent_today()
{'tweets_sent_today': 4539558}

>>> worldometer.get_metric_of(label='computers_produced_this_year')
{'computers_produced_this_year': 27760858}

Or complete use with Worldometer Class:

>>> from worldometer import Worldometer
>>> w = Worldometer()

>>> w.what_is_here()
{'categories': 8, 'labels': 63, 'metrics': 63}

>>> w.categories()
[   
    'world_population',
    'government_and_economics',
    'society_and_media',
    ...  # compressed
]

>>> w.metrics_labels()
[   
    'current_world_population',
    'births_this_year',
    'births_today',
    'deaths_this_year',
    'deaths_today',
    'net_population_growth_this_year',
    ...  # compressed
]

>>> w.metrics()
[   
    7845087963,
    15741371,
    5676,
    6608605,
    2383,
    9132766,
    ...  # compressed
]

>>> w.metrics_with_labels()
{   
    'abortions_this_year': 4785492,
    'bicycles_produced_this_year': 17070566,
    'births_this_year': 15741371,
    'births_today': 5676,
    'blog_posts_written_today': 110171,
    'cars_produced_this_year': 8999185,
    'cellular_phones_sold_today': 98846,
    ...: ...  # compressed
}

Contributions

All contributions are welcome!

Found a problem, want to give a tip? open an issue

Do you have a solution to the problem? Send me a PR

Did you like this project? Click on the star ⭐

License

This project is using the MIT license, see in MIT LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

worldometer-1.0.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

worldometer-1.0.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file worldometer-1.0.0.tar.gz.

File metadata

  • Download URL: worldometer-1.0.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for worldometer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 14592ab06f7052803e9ba20176ceeb2b2797419e103f842bace8fcf10da2f36b
MD5 67a251299b4f4b8d31648e9d221f3749
BLAKE2b-256 072fad069cf7895c109b75f28a783cde1764e668294b58cb028327a4fc341be6

See more details on using hashes here.

File details

Details for the file worldometer-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: worldometer-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for worldometer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f935aa5ae19d9364f5581dca1391770c5936079a57a5ac2610ba17f80cf85f
MD5 6c4b68f48bbc2359489de183d4b54dc1
BLAKE2b-256 d3dfa543274966e4cd51ccc2bc5052300d0294c518f332ccf22ef3d995cfcce4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page