"### Create an object and turn an HTML page into a soup object"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Fetching the raw HTML page"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"query = \"playstation+5\" # Put your search term here\n",
"my_url = 'YOUR_EBAY_URL'.format(query) # Paste the url for an Ebay search from your browser and replace the query part with a {}\n",
"my_url"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"uClient = uReq(my_url)\n",
"page_html = uClient.read()\n",
"uClient.close()\n",
"\n",
"page_soup = soup(page_html, 'html.parser')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Find all the relevant classes and extract data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"divs = page_soup.findAll('div',{'class':'s-item__details clearfix'}) # Find the HTML tag with the data we are looking for and fetch all instances of it\n",