A Light in the ...
\n", "£51.77
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Web Scraping using Python\n", "\n", "### Project - Working with Multiple Pages and Items\n", "\n", "Let's show a more realistic example of scraping a full site. The website: http://books.toscrape.com/index.html is specifically designed for people to scrape it. Let's try to get the title of every book that has a 2 star rating and at the end just have a Python list with all titles.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Import Libraries" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "from bs4 import BeautifulSoup\n", "import requests\n", "import pandas as pd\n", "import re" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "
£51.77
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£53.74
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£50.10
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£47.82
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£54.23
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£22.65
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£33.34
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£17.93
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£22.60
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£52.15
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£13.99
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£20.66
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£17.46
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£52.29
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£35.02
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£57.25
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£23.88
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£37.59
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£51.33
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "£45.17
\n", "\n", " \n", " \n", " In stock\n", " \n", "
\n", " \n", "