{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Adafruit Scraper\n", "\n", "Quick script that loads a file with a list of product links from [adafruit](http://www.adfruit.com), then scrapes each page to grab the title, price and image url, and finally writes all the data in to a JSON file." ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | url | \n", "
---|---|
0 | \n", "https://www.adafruit.com/product/1782 | \n", "
1 | \n", "https://www.adafruit.com/product/1766 | \n", "
2 | \n", "https://www.adafruit.com/product/2652 | \n", "
3 | \n", "https://www.adafruit.com/product/189 | \n", "
4 | \n", "https://www.adafruit.com/product/439 | \n", "
\n", " | 0 | \n", "1 | \n", "2 | \n", "3 | \n", "4 | \n", "5 | \n", "6 | \n", "7 | \n", "8 | \n", "9 | \n", "... | \n", "308 | \n", "309 | \n", "310 | \n", "311 | \n", "312 | \n", "313 | \n", "314 | \n", "315 | \n", "316 | \n", "317 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "[{\"title\": | \n", "MCP9808 High Accuracy I2C Temperature Sensor B... | \n", "price: | \n", "4.95, | \n", "url: | \n", "https://www.adafruit.com/product/1782, | \n", "image_url: | \n", "https://cdn-shop.adafruit.com/970x728/1782-00.... | \n", "{\"title\": | \n", "Fast Vibration Sensor Switch (Easy to trigger), | \n", "... | \n", "image_url: | \n", "https://cdn-shop.adafruit.com/970x728/2652-00.... | \n", "{\"title\": | \n", "Adafruit I2S 3W Stereo Speaker Bonnet for Rasp... | \n", "price: | \n", "12.95, | \n", "url: | \n", "https://www.adafruit.com/product/3346, | \n", "image_url: | \n", "https://cdn-shop.adafruit.com/970x728/3346-01.... | \n", "
1 rows × 318 columns
\n", "