Git Product home page Git Product logo

bbc_news_scraper's Introduction

BBC News Scraper

This repository is based on @keleog's BBC Pidgin Scraper but generalizes to a lot more languages:

Language Language Code Website
Afaan Oromoo afa https://www.bbc.com/afaanoromoo
Afrique afr https://www.bbc.com/afrique
Amharic amh https://www.bbc.com/amharic
Gahuza gah https://www.bbc.com/gahuza
Hausa hau https://www.bbc.com/hausa
Igbo igb https://www.bbc.com/igbo
Somali som https://www.bbc.com/somali
Swahili swa https://www.bbc.com/swahili
Tigrinya tig https://www.bbc.com/tigrinya
Yoruba yor https://www.bbc.com/yoruba
Nigerian Pidgin pid https://www.bbc.com/pidgin

This scraper works fine as of 23rd of December, 2022.

Setup & Installation

  • Create a virtual environment
  • Install required packages
pip install -r requirements.txt

Using the scraper

  • To scrape all articles from all categories
python scraper.py --no_of_articles=-1 --language <language-code> --output_file_name=data/<filename.tsv> --categories=all --time_delay=True --cleanup
  • To scrape a finite amount of articles from all categories
python scraper.py --no_of_articles=<no-of-articles> --language <language-code> --output_file_name=data/<filename.tsv> --categories=all --time_delay=True --cleanup --spread
  • To check the full list of arguments for the scraper
python scraper.py --help

You can check language codes in the table above. The scraper output should be a tsv file with four columns: heading, text, category, url. See sample output in data

Contribution

BBC regularly changes the HTML class attributes and structure of its website. To ensure that this scraper is maintainable over time, class attributes and other such configurations are separated into config.yaml. Feel free to raise an issue & open a pull request if you discover a bug or want to propose an improvement.

bbc_news_scraper's People

Contributors

tunde99 avatar theyorubayesian avatar donmonc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.