Example 1 – scraping data science announcements

In this example, we will be scraping announcements-related details that are found within the data science category from https://developer.ibm.com/announcements/category/data-science/.

The same URL from https://developer.ibm.com/ has also been used to collect data using lxml.cssselect under Example 3, in the Web scraping using LXML section from Chapter 3, Using LXML, XPath, and CSS Selectors. It is suggested that you explore both examples and compare the features that were used.

To begin with, let's import pyquery and requests:

from pyquery import PyQuery as pqimport requestsdataSet = list()

Create dataSet so that you have an empty list to collect data that we will find from various pages, along ...

Get Hands-On Web Scraping with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.