Coder Social home page Coder Social logo

newswebsitescraping's Introduction

News Article Scraper

I wrote this script as a means of automatically collecting my own dataset of article titles and their subjects from a handful of different news outlets.

Where does the script get it's articles from?

The script takes all articles from the RSS feeds of the Guardian, BBC, RT and CNN. The reason it takes articles from the RSS feeds as it's much simpler to parse the XML format instead of the jumbled up and often-times confusing HTML format. I originally scraped articles from their regular HTML format using beautiful soup in python but the slightest of changes to the website formats messed it up and the logic behind the extracting of information was quite convoluted.

Usage

No external dependencies are required so you can go right ahead and run the scripts.

Go

go run articleGet.go

Python

python articleGet.py

Go vs Python

I initially wrote this script in python because it was the most straight forward way of doing it at the time. However more recently having started to pick up go I've been curious as to how much faster it can do the same task. Go is a compiled language so it would have an inherant advantage but I just wanted to rub it in. I timed the execution of the scripts and heres the averages of the time taken to run the script on both python and go.

Go Python
1.2s 12.8s

So, yeah. ❤️ Go ❤️

What is the point of this?

After a few months when I have a few thousand articles from every category I'll analyse the patterns and trends in topics and phrases etc.

Contributing

In the unlikely event you'd want to contribute to this project and perhaps extend it's funtionality, fix a bug or get rid of some whitespace go ahead and make a PR and I'd be glad to review it.

newswebsitescraping's People

Contributors

iamcathal avatar

Stargazers

 avatar

Watchers

 avatar  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.