A python package to scrape data from GhanaWeb
Project description
GhanaWeb Scraper
A simple unofficial python package to scrape data from Ghanaweb. Affiliated to bank-of-ghana-fx-rates
How to install
pip install ghanaweb-scraper
Warning: DO NOT RUN IN ONLINE JUPYTERNOTEBOOKS eg. Colabs
Usage
from ghanaweb.scraper import GhanaWeb
url = 'https://www.ghanaweb.com/GhanaHomePage/politics/'
# url = 'https://www.ghanaweb.com/GhanaHomePage/health/'
# url = 'https://www.ghanaweb.com/GhanaHomePage/crime/'
# url = 'https://www.ghanaweb.com/GhanaHomePage/regional/'
# url = 'https://www.ghanaweb.com/GhanaHomePage/year-in-review/'
# web = GhanaWeb(url='https://www.ghanaweb.com/GhanaHomePage/politics/')
web = GhanaWeb(url=url)
# scrape data and save to `current working dir`
web.download(output_dir=None)
scrape list of articles
from ghanaweb.scraper import GhanaWeb
urls = [
'https://www.ghanaweb.com/GhanaHomePage/politics/',
'https://www.ghanaweb.com/GhanaHomePage/health/',
'https://www.ghanaweb.com/GhanaHomePage/crime/',
'https://www.ghanaweb.com/GhanaHomePage/regional/',
'https://www.ghanaweb.com/GhanaHomePage/year-in-review/'
]
for url in urls:
print(f"Downloading: {url}")
web = GhanaWeb(url=url)
# download to current working directory
# if no location is specified
# web.download(output_dir="/Users/tsiameh/Desktop/")
web.download(output_dir=None)
BuyMeCoffee
Credits
Theophilus Siameh
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
ghanaweb-scraper-1.0.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for ghanaweb_scraper-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43e151343edcf0ca5f91d7558f8a1da7a9298ae15434e300af18433cdb520534 |
|
MD5 | a22682c15ee4c1e8959eb4822fb73741 |
|
BLAKE2b-256 | 63498b899ef9482f1078db6b9dd8cf921133e1e033a7f5c7d6801ac4d1c04d4d |