Web scraper to get news article content

user profile photouser profile photouser profile photo2196 developers have joined this project.

What you will practice

You'll practice how to use Python libraries to obtain web page content and how to select the elements you need on a web page. These are fundamental skills used to build applications which scrape content from other websites.

Introduction

We want to build a simple web scraper that will return the content of a news article when given a specific URL. Some examples of real products which use similar technologies include price-tracking websites and SEO audit tools which may scrape top search results. This project may take you around 4 to 8 hours to complete.

Requirements

Choose one news website - see article examples below for inspiration. Given a specific article URL from the website of your choice, return the title and content of the article to the user.

Examples article URLs:

For an extra challenge: Parse out information such as the article title, updated date, and byline to return separately to the user.

Suggested Implementation

You can use something similar to this service in command line:

> python scrape_newyorktimes.py news_url

We suggest using a HTTP library like Requests to get the raw HTML file of the URL. Then use a parsing library like Beautiful Soup to parse the content. Alternatively, you can also use a Python scraping tool like Scrapy.

References

  • You can use xPath to select elements if there’s no class or div for the element
  • Take note of the Python version you have installed! (reference)

Interested in this project?

Shorten your learning curve with on-demand programming help

The awesome set of verified mentors will provide guidance and mentoring help when you are stuck.

Suresh Atta

  • Post request free
  • First 15 mins free
Shorten your learning curve with on-demand programming help

Browse more projects

More coming soon...