The ultimate library for data scientist to scrape data from https://www.lefaso.net
Project description
lefaso-net-scraper
Description
lefaso-net-scraper is a robust and versatile Python library designed to efficiently extract articles from the popular online news source of of Burkina Faso, www.lefaso.net. This powerful scraping tool allows users to effortlessly collect article content and data from Internet users’ comments on lefaso.net.
Important
Our scraper, like other scrapers, is based on the structure of the target website. Changes to the website's structure can affect the scraper. We use automated workflows to detect these issues frequently, but we cannot catch all of them. Please report any issues you encounter and use the latest version.
Data Format
Field | Description |
---|---|
article_topic | article topic |
article_title | article title |
article_published_date | article published date |
article_origin | article origin |
article_url | article url |
article_content | article content |
article_comments | article comments |
Installation
- With poetry
poetry add lefaso-net-scraper
poetry update lefaso-net-scraper # to update the package
- With pip
pip install --upgrade lefaso-net-scraper
Usage
# coding: utf-8
from lefaso_net_scraper import LefasoNetScraper
section_url = 'https://lefaso.net/spip.php?rubrique473'
scraper = LefasoNetScraper(section_url)
data = scraper.run()
- Settings Pagination range
# coding: utf-8
from lefaso_net_scraper import LefasoNetScraper
section_url = 'https://lefaso.net/spip.php?rubrique473'
scraper = LefasoNetScraper(section_url)
scraper.set_pagination_range(start=20, stop=100)
data = scraper.run()
- Save data to csv
# coding: utf-8
from lefaso_net_scraper import LefasoNetScraper
import pandas as pd
section_url = 'https://lefaso.net/spip.php?rubrique473'
scraper = LefasoNetScraper(section_url)
data = scraper.run()
df = pd.DataFrame.from_records(data)
df.to_csv('path/to/df.csv')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lefaso_net_scraper-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ee9b58c099a64970506e1177fddf2d447d38f931fd74563c97f74fca55db0ee |
|
MD5 | aef23851143dce172ad03e6ba1cc01b3 |
|
BLAKE2b-256 | 9c04f98ff56e98897c2d7f5d7ccd766f49217a1767f079a304eb99b774a9f8ff |