From f64e3d24ef07a1fd020f1920acf10e63d643ae24 Mon Sep 17 00:00:00 2001 From: LuciaGPalos <113399853+LuciaGPalos@users.noreply.github.com> Date: Wed, 30 Nov 2022 18:00:07 -0600 Subject: [PATCH 1/3] Draft project --- amazon_webscrapping.csv | 3 + amazonbasics.html | 1857 +++++++++++++++++++++++++++++++++++++++ webscrapping.ipynb | 306 +++++++ 3 files changed, 2166 insertions(+) create mode 100644 amazon_webscrapping.csv create mode 100644 amazonbasics.html create mode 100644 webscrapping.ipynb diff --git a/amazon_webscrapping.csv b/amazon_webscrapping.csv new file mode 100644 index 0000000..1015e39 --- /dev/null +++ b/amazon_webscrapping.csv @@ -0,0 +1,3 @@ +N/AN/A, +N/A, +NA, diff --git a/amazonbasics.html b/amazonbasics.html new file mode 100644 index 0000000..458862e --- /dev/null +++ b/amazonbasics.html @@ -0,0 +1,1857 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Amazon.com.mx: Amazon Basics + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + +
+ + + + + + + +
+ + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/webscrapping.ipynb b/webscrapping.ipynb new file mode 100644 index 0000000..a8453c7 --- /dev/null +++ b/webscrapping.ipynb @@ -0,0 +1,306 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 224, + "id": "7a65bb85-4064-4b76-8de8-175a40bcaf4c", + "metadata": {}, + "outputs": [], + "source": [ + "from bs4 import BeautifulSoup\n", + "import requests\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 188, + "id": "ab5e8826-aa27-43df-9335-2e500a3ed303", + "metadata": {}, + "outputs": [], + "source": [ + "amazonfile= open('amazon_webscrapping.csv','a')" + ] + }, + { + "cell_type": "code", + "execution_count": 202, + "id": "e6890df5-f08c-4ad0-8497-a3c22070d4dd", + "metadata": {}, + "outputs": [], + "source": [ + "colnames = ['ITEM', 'PRICE','RATING'] " + ] + }, + { + "cell_type": "code", + "execution_count": 220, + "id": "f8fabf91-9e2d-4b90-882f-444309b1917a", + "metadata": {}, + "outputs": [], + "source": [ + "data = pd.read_csv('amazon_webscrapping.csv', names=colnames, header=None)" + ] + }, + { + "cell_type": "markdown", + "id": "47361423-98c2-427c-9a43-500741287da1", + "metadata": {}, + "source": [ + "# Authentication" + ] + }, + { + "cell_type": "markdown", + "id": "4d7caf16-671c-4e47-bd1d-19a371a854f0", + "metadata": {}, + "source": [ + "Check price of one article (iphone 14)" + ] + }, + { + "cell_type": "code", + "execution_count": 148, + "id": "d3104c26-edcd-4ed0-b9ff-7f120ae63fd6", + "metadata": {}, + "outputs": [], + "source": [ + "URL = 'https://www.amazon.com.mx/AmazonBasics-Cama-para-perro-redonda/dp/B07233P1W2?ref_=ast_sto_dp&th=1&psc=1'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "491fdf5c-cf0f-45de-aaf4-1a975a64438c", + "metadata": {}, + "outputs": [], + "source": [ + "##crear logicas de for i in URL que el programa agarre cada url y vaya construyendo la tabla en vez de copiar y pegar el url de manera manual. \n", + "#checar como hacer esto!" + ] + }, + { + "cell_type": "code", + "execution_count": 149, + "id": "366f147d-e335-463f-9568-1c89ec9a84d2", + "metadata": {}, + "outputs": [], + "source": [ + "headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 150, + "id": "0ef22c3e-5a14-4854-9daf-32be616e2a7c", + "metadata": {}, + "outputs": [], + "source": [ + "response = requests.get(URL, headers=headers)" + ] + }, + { + "cell_type": "code", + "execution_count": 151, + "id": "123c610f-0061-424c-9e0a-9f8eba488781", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "200\n" + ] + } + ], + "source": [ + "print(response.status_code)" + ] + }, + { + "cell_type": "code", + "execution_count": 192, + "id": "a8e10dae-f975-42d3-b3c8-c91a05dda162", + "metadata": {}, + "outputs": [], + "source": [ + "content = BeautifulSoup(response.content,'lxml')" + ] + }, + { + "cell_type": "code", + "execution_count": 193, + "id": "11d1dbba-c7f9-4726-875a-fdec007ffb42", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "bs4.BeautifulSoup" + ] + }, + "execution_count": 193, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(content)" + ] + }, + { + "cell_type": "markdown", + "id": "0558775c-04f6-4372-9fa3-53b55b79ef5e", + "metadata": {}, + "source": [ + "# Get data" + ] + }, + { + "cell_type": "code", + "execution_count": 223, + "id": "2eb6ae12-4ec0-42e0-96ca-c7e8e0a25436", + "metadata": {}, + "outputs": [], + "source": [ + "#product title\n", + "try:\n", + " title = content.find_all('span',{'id': 'productTitle'}).get_text\n", + " title = title.strip()[1:].replace(',', '')\n", + "except AttributeError:\n", + " title = ''" + ] + }, + { + "cell_type": "code", + "execution_count": 215, + "id": "5ade6aeb-360b-4ff7-9742-d907d5ecf1be", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 215, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#saving the title\n", + "amazonfile.write(f'{title}\\n')" + ] + }, + { + "cell_type": "code", + "execution_count": 216, + "id": "268a5fa1-47d4-45c0-bfef-fb94b90e6474", + "metadata": {}, + "outputs": [], + "source": [ + "#product price\n", + "try:\n", + " price = content.find_all('span',{'class': 'a-price-whole'})\n", + " price = price.strip().replace(',', '')\n", + "except AttributeError:\n", + " price = ''" + ] + }, + { + "cell_type": "code", + "execution_count": 217, + "id": "d85ce0bd-3287-4744-a42e-108fd5a6d7ab", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 217, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#saving the price\n", + "amazonfile.write(f'{price}\\n')" + ] + }, + { + "cell_type": "code", + "execution_count": 218, + "id": "64c6b2ab-fee7-450d-8aad-84badb67509c", + "metadata": {}, + "outputs": [], + "source": [ + "#product rating\n", + "try:\n", + " rating = content.find('i', {'class': 'a-icon a-icon-star a-star-4-5'}).text\n", + " rating = rating.strip().replace(',', '')\n", + "except AttributeError:\n", + " try:\n", + " rating = content.find(\"span\", {'class': 'a-icon-alt'}).string.strip().replace(',', '')\n", + " except:\n", + " rating = ''" + ] + }, + { + "cell_type": "code", + "execution_count": 219, + "id": "1e5979e2-8214-49e1-92a9-0ced3c6388f9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 219, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#saving the rating\n", + "amazonfile.write(f'{rating}\\n')" + ] + }, + { + "cell_type": "code", + "execution_count": 182, + "id": "1cd392f5-ad28-4075-8af8-f039569138cc", + "metadata": {}, + "outputs": [], + "source": [ + "amazonfile.close()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 31bc3c53478da644d11acaa9fd8bed1d78abdfe6 Mon Sep 17 00:00:00 2001 From: LuciaGPalos Date: Fri, 2 Dec 2022 19:12:56 -0600 Subject: [PATCH 2/3] Updated project DAPTSEP2022 Lucia --- .ipynb_checkpoints/README-checkpoint.md | 46 + .ipynb_checkpoints/output-checkpoint.csv | 119 ++ .../webscrapping-checkpoint.ipynb | 901 ++++++++ README.md | 36 +- amazon_webscrapping.csv | 3 - amazonbasics.html | 1857 ----------------- output.csv | 119 ++ webscrapping.ipynb | 877 ++++++-- 8 files changed, 1926 insertions(+), 2032 deletions(-) create mode 100644 .ipynb_checkpoints/README-checkpoint.md create mode 100644 .ipynb_checkpoints/output-checkpoint.csv create mode 100644 .ipynb_checkpoints/webscrapping-checkpoint.ipynb delete mode 100644 amazon_webscrapping.csv delete mode 100644 amazonbasics.html create mode 100644 output.csv diff --git a/.ipynb_checkpoints/README-checkpoint.md b/.ipynb_checkpoints/README-checkpoint.md new file mode 100644 index 0000000..dc8bae8 --- /dev/null +++ b/.ipynb_checkpoints/README-checkpoint.md @@ -0,0 +1,46 @@ +![IronHack Logo](https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/upload_d5c5793015fec3be28a63c4fa3dd4d55.png) + +# Project: API and Web Data Scraping + +## Overview + +The goal of this project is for you to practice what you have learned in the APIs and Web Scraping chapter of this program. For this project, you will choose both an API to obtain data from and a web page to scrape. For the API portion of the project will need to make calls to your chosen API, successfully obtain a response, request data, convert it into a Pandas data frame, and export it as a CSV file. For the web scraping portion of the project, you will need to scrape the HTML from your chosen page, parse the HTML to extract the necessary information, and either save the results to a text (txt) file if it is text or into a CSV file if it is tabular data. + +**You will be working individually for this project**, but we'll be guiding you along the process and helping you as you go. Show us what you've got! + +--- + +## Technical Requirements + +The technical requirements for this project are as follows: + +* You must obtain data from an API using Python. +* You must scrape and clean HTML from a web page using Python. +* The results should be two files - one containing the tabular results of your API request and the other containing the results of your web page scrape. +* Your code should be saved in a Jupyter Notebook and your results should be saved in a folder named output. +* You should include a README.md file that describes the steps you took and your thought process for obtaining data from the API and web page. + +## Necessary Deliverables + +The following deliverables should be pushed to your Github repo for this chapter. + +* **A Jupyter Notebook (.ipynb) file** that contains the code used to work with your API and scrape your web page. +* **An output folder** containing the outputs of your API and scraping efforts. +* **A ``README.md`` file** containing a detailed explanation of your approach and code for retrieving data from the API and scraping the web page as well as your results, obstacles encountered, and lessons learned. + +## Suggested Ways to Get Started + +* **Find an API to work with** - a great place to start looking would be [API List](https://apilist.fun/) and [Public APIs](https://github.com/toddmotto/public-apis). If you need authorization for your chosen API, make sure to give yourself enough time for the service to review and accept your application. Have a couple back-up APIs chosen just in case! +* **Find a web page to scrape** and determine the content you would like to scrape from it - blogs and news sites are typically good candidates for scraping text content, and [Wikipedia](https://www.wikipedia.org/) is usually a good source for HTML tables (search for "list of..."). +* **Break the project down into different steps** - note the steps covered in the API and web scraping lessons, try to follow them, and make adjustments as you encounter the obstacles that are inevitable due to all APIs and web pages being different. +* **Use the tools in your tool kit** - your knowledge of intermediate Python as well as some of the things you've learned in previous chapters. This is a great way to start tying everything you've learned together! +* **Work through the lessons in class** & ask questions when you need to! Think about adding relevant code to your project each night, instead of, you know... _procrastinating_. +* **Commit early, commit often**, don’t be afraid of doing something incorrectly because you can always roll back to a previous version. +* **Consult documentation and resources provided** to better understand the tools you are using and how to accomplish what you want. + +## Useful Resources + +* [Requests Library Documentation: Quickstart](http://docs.python-requests.org/en/master/user/quickstart/) +* [BeautifulSoup Documentation](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) +* [Stack Overflow Python Requests Questions](https://stackoverflow.com/questions/tagged/python-requests) +* [StackOverflow BeautifulSoup Questions](https://stackoverflow.com/questions/tagged/beautifulsoup) diff --git a/.ipynb_checkpoints/output-checkpoint.csv b/.ipynb_checkpoints/output-checkpoint.csv new file mode 100644 index 0000000..c426303 --- /dev/null +++ b/.ipynb_checkpoints/output-checkpoint.csv @@ -0,0 +1,119 @@ +index,href,Description,Color,Model,Size,Body Wood,Body Finish,Body Colors,Bridge,Scale Length,Neck Radius,Headstock Size,Frets,Neck Width,Neck Wood,Fingerboard,Fret Markers,Neck Finish,Neck Colors,Tuning Machines,Truss Rod,Neck Attachment,Electronic Shielding,Controls,Switching,Pickups,Left Handed,Strings,Pickguard,Order,Neck Binding,Body Bindings +StingRay 5 35th Anniversary,basses/stingray-5-35th-anniversary," +In 1987 Ernie Ball Music Man created the legendary StingRay 5 bass, setting the standard for the modern 5-string bass. The 35th Anniversary edition honors the timeless Ernie Ball Music Man design that has been used by some of the world’s most iconic bassists. The ash body features a spalted maple top with thin maple veneer and comes standard with a Spalted Sunburst finish. The roasted figured maple neck features an ebony fretboard, copper pearlescent block inlays and is finished in a high gloss for superb comfort and playability. High-output neodymium StingRay 5 pickups provide powerful low-end with a distinctive mid-range punch while the lightweight hardware delivers solid stability. Limited to 225 single-humbucker and 25 dual-humbucker models, every Anniversary StingRay 5 includes a certificate of authenticity. +"," + + + +Spalted Sunburst + + + +",StingRay 5 35th Anniversary,"13-3/8"" wide, 1-3/4"" thick, 45-3/4"" long (34.0 cm wide, 4.5 cm thick, 116.2 cm long)",Ash,High gloss polyester,Spalted Sunburst,"Standard - Music Man® Black plated, hardened steel bridge plate with stainless steel saddles","34"" (86.4 cm)","11"" (27.9 cm)","Only 9"" (22.9 cm) long","22 - High profile, wide, Stainless Steel","1-3/4"" (44.5 mm) at nut 2-3/4"""" (69.9 mm) at last fret",Select roasted maple,Ebony ,Copper Pearloid Atlante Blocks,High gloss polyester,Natural,"Custom Music Man, lightweight with tapered string posts and ergonomic clover design",Adjustable - no component or string removal,"5 bolt, sculpted neck joint",Graphite acrylic resin coated body cavity and aluminum control cover,"3-band active preamp with 18 volts of headroom; vol, treble, mid, bass",H: 3-way lever pickup selector; HH: 5-way lever pickup selector,Single or Dual Humbucking with Neodymium Magnets,No,46w-65w-80w-100w-130w (Regular Slinky Bass #2836),,,, +StingRay Special Collection,families/basses/stingray-special,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Short Scale StingRay,basses/short-scale-stingray," +The Ernie Ball Music Man Short Scale StingRay bass offers a big thumpy round sound in a convenient smaller package. A 30” scale allows for easier playability due to the shorter spacing between the frets. The Ernie Ball Music Man passive humbucking pickup, equipped with higher output neodymium magnets, has been specially designed for the short scale bass, providing its signature warm tone. The electronics package includes a 3-way rotary switch featuring parallel, true single-coil, and series modes. Like its big brother, the Stingray Special, the short scale bass comes standard with a modern classic bridge, 22 stainless steel frets, and new lightweight Music Man tuning machines with a finer gear ratio. +"," + + + +Candy Man + + + + + + +Burnt Ends + + + + + + +Vincent Blue + + + + + + +Silver Shadow + + + + + + +Plum Crazy + + + +",Short Scale StingRay Bass,"12-3/8"" wide, 1-5/8"" thick, 40-7/8"" long (31.4 cm wide, 4.1 cm thick, 103.8 cm long)",Ash,High gloss polyester,,"Vintage Music Man® top loaded chrome plated, steel bridge plate with vintage nickel plated steel saddles","30"" (76.2 cm)",,,"22 - High profile, wide stainless steel","1-1/2"" (38.1 mm) at the nut, 2-3/8"" (60.3 cm) at the last fret",Select Maple,,"5/16"" Dot Inlay",Gunstock oil and hand-rubbed special wax blend,,"Custom Music Man, lightweight with tapered string posts and ergonomic clover design",Adjustable - no component or string removal,"5 bolt, sculpted neck joint",Chrome plated aluminum control cover,"Passive 500kohm push/push volume POT for gain boost, 100kohm tone POT - 0.1uf tone cap",3-way rotary pickup selector ,Single Music Man humbucking pickup- neodymium magnets,No,45w-65w-85w-105w (Short Scale Regular Slinky Bass #2852),,,, +DarkRay,families/basses/darkray,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Joe Dart Collection,families/basses/joe-dart,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Tim Commerford,basses/tim-commerford," +Welcome to the Tim Commerford Artist Series StingRay collection. These brand-new limited-edition Ernie Ball Music Man instruments were designed in conjunction with Tim Commerford, the legendary bassist of Rage Against the Machine, Audioslave, and his newest project, 7D7D. Tim has been a part of the Ernie Ball Music Man family for many years, and this collaboration is the natural evolution of his enduring passion for the StingRay bass. With active and passive options for both short-scale and full-scale, you’re sure to find the right match for your playing style. The passive full-scale and active short-scale models deserve special consideration, as Music Man has never before offered these configurations. + +Over the last 30 years, Commerford has perfected his signature sound, playing many passive and active basses. The ability to have both full and short-scale, active and passive basses in one collection gives Tim the tools required to reproduce the sounds made famous throughout his career. +"," + + + +Black Full-Scale (Active) + + + + + + +Natural Full-Scale (Passive) + + + +",Tim Commerford Active Short-Scale,"12-3/8"" wide, 1-5/8"" thick, 40-7/8"" long (31.4 cm wide, 4.1 cm thick, 103.8 cm long)",Ash,High gloss polyester,Natural Gloss,"Music Man® chrome plated, strings-thru-the-body & hardened steel bridge plate with vintage nickel plated steel saddles and adjustable mute pads","30"" (76.2 cm)","11"" (27.9 cm)","8"" (20.3 cm) long","22 - High profile, wide stainless steel","1-1/2"" (38.1 mm) at the nut, 2-3/8"" (60.3 cm) at the last fret",Select Maple,Maple,"5/16"" Dot Inlay",Gunstock oil and hand-rubbed special wax blend,,"Custom Music Man, lightweight with tapered string posts and ergonomic clover design",,"5 bolt, sculpted neck joint",Chrome plated aluminum control cover,"3-band active preamp with 18 volts of headroom; vol, treble, mid, bass",,Single Humbucking with Neodymium magnets,,45w-65w-85w-105w (Medium Scale Regular Slinky Bass #2856),Black,,, +Bongo Collection,families/basses/bongo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +John Myung,basses/john-myung," +The John Myung artist series Bongo is a sleek, ultra-modern 6 string bass crafted and perfected to John's exacting specifications. +With over a decade long refinement process, John and the Ernie Ball Music Man engineering team have addressed a multitude of design features to further enhance comfortability, playability, and overall performance. Some key features include a simplified control layout with preprogrammed equalization, a perfectly balanced compact basswood body mated to a maple neck with 5 string nut width for tighter string spacing, and a golden ratio fretboard utilizing a combination of rosewood and roasted maple for an elegant aesthetic. This instrument is truly an artist inspired design that facilitates John's needs as a performance artist and master technician. +"," + + + +Platinum Silver + + + + + + +Black + + + +",John Myung Bongo 6 HH,"12-3/4"" wide, 1-5/8"" thick, 47-5/8"" long (32.4 cm wide, 4.1 cm thick, 121.0 cm long)",Basswood,High gloss polyester,Black,"Music Man® chrome plated, steel bridge plate with stainless steel saddles","34"" (86.4 cm)","11"" (27.9 cm)","Only 9-3/4"" (24.8 cm) long","24 - High profile, wide","1-3/4"" (44.5 mm) at nut 2-13/16"" (71.4 mm) at last fret",Roasted Maple Neck,Rosewood/Roasted Maple,White Half moon inlay,Oil and Wax,Natural,"Custom Music Man, lightweight with tapered string posts and ergonomic design",,"5 bolt, sculpted neck joint",Graphite acrylic resin coated body cavity and aluminum control cover,Volume,5-way pickup blend knob,Dual Humbucking with Neodymium magnets,No,32w-45w-65w-80w-100w-130w (Cobalt Bass),Black,1,N/A, +Mike Herrera,basses/mike-herrera," +Introducing the Ernie Ball Music Man Mike Herrera StingRay bass. For more than two decades MXPX frontman and bassist Mike Herrera has wielded a custom StingRay, modified to his unique specifications. Now, Herrera’s secret weapon is available to the public. The Mike Herrera StingRay features an ash body with Seafoam Green finish, a matching headstock, an engraved white pearloid pickguard, passive electronics (no battery required), and a custom laser engraved Artist Series neckplate. Having the appearance of a traditional 2-band EQ StingRay, the Herrera StingRay's pickup is actually wired straight to the jack with three dummy knobs. Additional features include a maple neck and fretboard, 21 nickel frets, six bolt neck, and alnico magnets. +"," + + + +Seafoam Green + + + +",Mike Herrera StingRay Bass,"13-1/2"" wide x 1-5/8"" thick x 44-7/8"" long (34.3 cm wide, 4.1 cm thick, 114.0 cm long)",Ash,High gloss polyester,Seafoam Green,"Music Man® Chrome plated, hardened steel bridge plate with stainless steel saddles","34"" (86.4 cm)","11"" (27.9 cm)",,"21 high profile wide, nickel silver","1-11/16"" (42.9mm) at nut, 2-1/2"" (63.5 mm) at last fret",Maple,Maple,Dot inlay,Gunstock oil and hand-rubbed special wax blend,Natural,"Schaller BM, with tapered string posts",,6 bolts - perfect alignment with no shifting,,"3 dummy knobs, pickup wired directly to jack",,Music Man® humbucking with Alnico magnets,no,50w-70w-85w-105w (Regular Slinky Bass #2832),"Engraved White Pearloid, 3-ply with black center layer",,, +Sterling Collection,families/basses/sterling,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cliff Williams,basses/cliff-williams," +The all-new Cliff Williams Icon Series StingRay Bass is the first in a series of limited handcrafted replicas made to capture the look, sound, and essence of iconic Music Man instruments. Initially dubbed “The #1 Workhorse,” Cliff's 1979 Stingray has been his favorite bass for more than 40 years. Built to the exacting specifications of his original, every detail and characteristic was carefully examined and addressed. Body contours, neck carve, pickup construction, and decades of wear and tear were dutifully replicated by Music Man’s team of master craftsmen. The resulting outcome is a finely crafted period-correct instrument that looks, feels, and sounds just like Cliff’s #1 Stingray bass. +Only 26 available worldwide. +Listen to our podcast episode with Cliff Williams and Ernie Ball Music Man engineer Blair Ridings. +"," + + + +Back in Burst + + + +",Cliff Williams StingRay,"13-1/2"" wide x 1-5/8"" thick x 44-7/8"" long (34.3 cm wide, 4.1 cm thick, 114.0 cm long)",3-Piece Trans Poplar,Nitrocellulose Lacquer,Back in Burst,"Pre-EB Geometry Music Man® chrome plated, steel bridge plate with vintage stainless steel saddles","34"" (86.4 cm)","7.5"" (19.1 cm)","8-3/4"" (22.2 cm) long","21 - Low profile, wide","2-1/2"" (63.5 mm)",Select maple neck,Natural aged light yellow finish,"5/16"" Dot Inlay",Nitrocellulose Lacquer,Natural aged light yellow finish,"Schaller BM, with tapered string posts",,"3 Bolt, Pre EB Music Man Design with Micro-Tilt Neck Shim Adjustment",Chrome plated brass control cover & Copper Insulating Tape in Control Cavity,"Custom 2-band active preamp; vol, treble, bass",,Custom humbucking with 8 elongated Alnico magnets,No,50w-70w-85w-105w (Group II Flatwound #2804),N/A,,N/A,N/A diff --git a/.ipynb_checkpoints/webscrapping-checkpoint.ipynb b/.ipynb_checkpoints/webscrapping-checkpoint.ipynb new file mode 100644 index 0000000..cdb9611 --- /dev/null +++ b/.ipynb_checkpoints/webscrapping-checkpoint.ipynb @@ -0,0 +1,901 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Modules" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from bs4 import BeautifulSoup\n", + "import requests\n", + "import pandas as pd" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Variables" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "stingray_url = 'https://www.music-man.com/instruments/'\n", + "basses_url = 'https://www.music-man.com/instruments/basses/'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Get data" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Make the call" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "response = requests.get(basses_url)\n", + "content = BeautifulSoup(response.content,'lxml')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Obtain the products" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "products = content.find('section', {'class': 'guitar-bg'}).find_all('div', {'class': 'guitar-imgs text-center'})" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "For each product, get the name and url" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "products_dict = {}\n", + "\n", + "for product in products:\n", + " \n", + " product = product.find('a', {'class': 'the-steve'})\n", + " products_dict[product.text] = [product.attrs['href']]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Convert to DF to manipulate it more easily" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "products_df = pd.DataFrame(products_dict).transpose()\n", + "products_df.columns = ['href']\n", + "products_df.index = products_df.reset_index()['index'].apply(lambda x : x.split('\\n')[1])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "At the moment, we only have the url to the instrument" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
href
index
StingRay 5 35th Anniversarybasses/stingray-5-35th-anniversary
StingRay Special Collectionfamilies/basses/stingray-special
Short Scale StingRaybasses/short-scale-stingray
DarkRayfamilies/basses/darkray
Joe Dart Collectionfamilies/basses/joe-dart
\n", + "
" + ], + "text/plain": [ + " href\n", + "index \n", + "StingRay 5 35th Anniversary basses/stingray-5-35th-anniversary\n", + "StingRay Special Collection families/basses/stingray-special\n", + "Short Scale StingRay basses/short-scale-stingray\n", + "DarkRay families/basses/darkray\n", + "Joe Dart Collection families/basses/joe-dart" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "products_df.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Obtain info per product" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Getting info for StingRay 5 35th Anniversary ...\n", + "Getting info for StingRay Special Collection ...\n", + "Getting info for Short Scale StingRay ...\n", + "Getting info for DarkRay ...\n", + "Getting info for Joe Dart Collection ...\n", + "Getting info for Tim Commerford ...\n", + "Getting info for Bongo Collection ...\n", + "Getting info for John Myung ...\n", + "Getting info for Mike Herrera ...\n", + "Getting info for Sterling Collection ...\n", + "Getting info for Cliff Williams ...\n" + ] + } + ], + "source": [ + "for name, url in zip(products_df['href'].index, products_df['href']):\n", + " \n", + " print(f'Getting info for {name} ...')\n", + " \n", + " # make the call to the url\n", + " response = requests.get(stingray_url + url)\n", + " content = BeautifulSoup(response.content,'lxml')\n", + " \n", + " # Some will fail since they are not pages that contain individdual basses, but rather\n", + " # redirect to more pages with more basses. An improvement to this project would be to explore those cases later\n", + " try:\n", + " products_df.loc[name, 'Description'] = content.find('p', {'class': 'instrument-desc'}).text\n", + " except AttributeError:\n", + " continue\n", + " \n", + " # Get the color\n", + " products_df.loc[name, 'Color'] = content.find('div', {'class': 'color-set row active'}).text\n", + " \n", + " # There are many specs contained in a table. Asign a column to each\n", + " columns = content.find_all('td', {'class': 'text-right'})\n", + " columns = [aux.text for aux in columns]\n", + " # This was done since there are some other values that, instead of being specs, are more\n", + " # like comparisons with other basses. Drop tse.\n", + " where_to_end = [1 if aux == 'Strings' else 0 for aux in columns ]\n", + " where_to_end = where_to_end.index(1) + 1\n", + " columns = columns[:where_to_end]\n", + "\n", + " # We get the values for each of the specs\n", + " values = content.find_all('td', {'class': 'text-left'})\n", + " values = [aux.text for aux in values]\n", + " values = values[:where_to_end]\n", + " \n", + " # And assign them to the DF\n", + " for column, value in zip(columns, values):\n", + " products_df.loc[name, column] = value" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can see that some url did not go through. This is because they have `families/` in them. When we look at these links, they each still have more independent links that can be accessed. Thus, for each of these ones, we could explore all the sublinks and get data for every bass." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
hrefDescriptionColorModelSizeBody WoodBody FinishBody ColorsBridgeScale Length...Electronic ShieldingControlsSwitchingPickupsLeft HandedStringsPickguardOrderNeck BindingBody Bindings
index
StingRay 5 35th Anniversarybasses/stingray-5-35th-anniversary\\nIn 1987 Ernie Ball Music Man created the leg...\\n\\n\\n\\nSpalted Sunburst\\n\\n\\n\\nStingRay 5 35th Anniversary13-3/8\" wide, 1-3/4\" thick, 45-3/4\" long (34.0...AshHigh gloss polyesterSpalted SunburstStandard - Music Man® Black plated, hardened s...34\" (86.4 cm)...Graphite acrylic resin coated body cavity and ...3-band active preamp with 18 volts of headroom...H: 3-way lever pickup selector; HH: 5-way leve...Single or Dual Humbucking with Neodymium MagnetsNo46w-65w-80w-100w-130w (Regular Slinky Bass #2836)NaNNaNNaNNaN
StingRay Special Collectionfamilies/basses/stingray-specialNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Short Scale StingRaybasses/short-scale-stingray\\nThe Ernie Ball Music Man Short Scale StingRa...\\n\\n\\n\\nCandy Man\\n\\n\\n\\n\\n\\n\\nBurnt Ends\\n\\n\\...Short Scale StingRay Bass12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4...AshHigh gloss polyesterNaNVintage Music Man® top loaded chrome plated, s...30\" (76.2 cm)...Chrome plated aluminum control coverPassive 500kohm push/push volume POT for gain ...3-way rotary pickup selectorSingle Music Man humbucking pickup- neodymium ...No45w-65w-85w-105w (Short Scale Regular Slinky B...NaNNaNNaNNaN
DarkRayfamilies/basses/darkrayNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Joe Dart Collectionfamilies/basses/joe-dartNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Tim Commerfordbasses/tim-commerford\\nWelcome to the Tim Commerford Artist Series ...\\n\\n\\n\\nBlack Full-Scale (Active)\\n\\n\\n\\n\\n\\n\\...Tim Commerford Active Short-Scale12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4...AshHigh gloss polyesterNatural GlossMusic Man® chrome plated, strings-thru-the-bod...30\" (76.2 cm)...Chrome plated aluminum control cover3-band active preamp with 18 volts of headroom...NaNSingle Humbucking with Neodymium magnetsNaN45w-65w-85w-105w (Medium Scale Regular Slinky ...BlackNaNNaNNaN
Bongo Collectionfamilies/basses/bongoNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
John Myungbasses/john-myung\\nThe John Myung artist series Bongo is a slee...\\n\\n\\n\\nPlatinum Silver\\n\\n\\n\\n\\n\\n\\nBlack\\n\\n...John Myung Bongo 6 HH12-3/4\" wide, 1-5/8\" thick, 47-5/8\" long (32.4...BasswoodHigh gloss polyesterBlackMusic Man® chrome plated, steel bridge plate w...34\" (86.4 cm)...Graphite acrylic resin coated body cavity and ...Volume5-way pickup blend knobDual Humbucking with Neodymium magnetsNo32w-45w-65w-80w-100w-130w (Cobalt Bass)Black1N/ANaN
Mike Herrerabasses/mike-herrera\\nIntroducing the Ernie Ball Music Man Mike He...\\n\\n\\n\\nSeafoam Green\\n\\n\\n\\nMike Herrera StingRay Bass13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34...AshHigh gloss polyesterSeafoam GreenMusic Man® Chrome plated, hardened steel bridg...34\" (86.4 cm)...NaN3 dummy knobs, pickup wired directly to jackNaNMusic Man® humbucking with Alnico magnetsno50w-70w-85w-105w (Regular Slinky Bass #2832)Engraved White Pearloid, 3-ply with black cent...NaNNaNNaN
Sterling Collectionfamilies/basses/sterlingNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Cliff Williamsbasses/cliff-williams\\nThe all-new Cliff Williams Icon Series Sting...\\n\\n\\n\\nBack in Burst\\n\\n\\n\\nCliff Williams StingRay13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34...3-Piece Trans PoplarNitrocellulose LacquerBack in BurstPre-EB Geometry Music Man® chrome plated, stee...34\" (86.4 cm)...Chrome plated brass control cover & Copper Ins...Custom 2-band active preamp; vol, treble, bassNaNCustom humbucking with 8 elongated Alnico magnetsNo50w-70w-85w-105w (Group II Flatwound #2804)N/ANaNN/AN/A
\n", + "

11 rows × 32 columns

\n", + "
" + ], + "text/plain": [ + " href \\\n", + "index \n", + "StingRay 5 35th Anniversary basses/stingray-5-35th-anniversary \n", + "StingRay Special Collection families/basses/stingray-special \n", + "Short Scale StingRay basses/short-scale-stingray \n", + "DarkRay families/basses/darkray \n", + "Joe Dart Collection families/basses/joe-dart \n", + "Tim Commerford basses/tim-commerford \n", + "Bongo Collection families/basses/bongo \n", + "John Myung basses/john-myung \n", + "Mike Herrera basses/mike-herrera \n", + "Sterling Collection families/basses/sterling \n", + "Cliff Williams basses/cliff-williams \n", + "\n", + " Description \\\n", + "index \n", + "StingRay 5 35th Anniversary \\nIn 1987 Ernie Ball Music Man created the leg... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay \\nThe Ernie Ball Music Man Short Scale StingRa... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford \\nWelcome to the Tim Commerford Artist Series ... \n", + "Bongo Collection NaN \n", + "John Myung \\nThe John Myung artist series Bongo is a slee... \n", + "Mike Herrera \\nIntroducing the Ernie Ball Music Man Mike He... \n", + "Sterling Collection NaN \n", + "Cliff Williams \\nThe all-new Cliff Williams Icon Series Sting... \n", + "\n", + " Color \\\n", + "index \n", + "StingRay 5 35th Anniversary \\n\\n\\n\\nSpalted Sunburst\\n\\n\\n\\n \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay \\n\\n\\n\\nCandy Man\\n\\n\\n\\n\\n\\n\\nBurnt Ends\\n\\n\\... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford \\n\\n\\n\\nBlack Full-Scale (Active)\\n\\n\\n\\n\\n\\n\\... \n", + "Bongo Collection NaN \n", + "John Myung \\n\\n\\n\\nPlatinum Silver\\n\\n\\n\\n\\n\\n\\nBlack\\n\\n... \n", + "Mike Herrera \\n\\n\\n\\nSeafoam Green\\n\\n\\n\\n \n", + "Sterling Collection NaN \n", + "Cliff Williams \\n\\n\\n\\nBack in Burst\\n\\n\\n\\n \n", + "\n", + " Model \\\n", + "index \n", + "StingRay 5 35th Anniversary StingRay 5 35th Anniversary \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Short Scale StingRay Bass \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Tim Commerford Active Short-Scale \n", + "Bongo Collection NaN \n", + "John Myung John Myung Bongo 6 HH \n", + "Mike Herrera Mike Herrera StingRay Bass \n", + "Sterling Collection NaN \n", + "Cliff Williams Cliff Williams StingRay \n", + "\n", + " Size \\\n", + "index \n", + "StingRay 5 35th Anniversary 13-3/8\" wide, 1-3/4\" thick, 45-3/4\" long (34.0... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay 12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford 12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4... \n", + "Bongo Collection NaN \n", + "John Myung 12-3/4\" wide, 1-5/8\" thick, 47-5/8\" long (32.4... \n", + "Mike Herrera 13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34... \n", + "Sterling Collection NaN \n", + "Cliff Williams 13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34... \n", + "\n", + " Body Wood Body Finish \\\n", + "index \n", + "StingRay 5 35th Anniversary Ash High gloss polyester \n", + "StingRay Special Collection NaN NaN \n", + "Short Scale StingRay Ash High gloss polyester \n", + "DarkRay NaN NaN \n", + "Joe Dart Collection NaN NaN \n", + "Tim Commerford Ash High gloss polyester \n", + "Bongo Collection NaN NaN \n", + "John Myung Basswood High gloss polyester \n", + "Mike Herrera Ash High gloss polyester \n", + "Sterling Collection NaN NaN \n", + "Cliff Williams 3-Piece Trans Poplar Nitrocellulose Lacquer \n", + "\n", + " Body Colors \\\n", + "index \n", + "StingRay 5 35th Anniversary Spalted Sunburst \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay NaN \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Natural Gloss \n", + "Bongo Collection NaN \n", + "John Myung Black \n", + "Mike Herrera Seafoam Green \n", + "Sterling Collection NaN \n", + "Cliff Williams Back in Burst \n", + "\n", + " Bridge \\\n", + "index \n", + "StingRay 5 35th Anniversary Standard - Music Man® Black plated, hardened s... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Vintage Music Man® top loaded chrome plated, s... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Music Man® chrome plated, strings-thru-the-bod... \n", + "Bongo Collection NaN \n", + "John Myung Music Man® chrome plated, steel bridge plate w... \n", + "Mike Herrera Music Man® Chrome plated, hardened steel bridg... \n", + "Sterling Collection NaN \n", + "Cliff Williams Pre-EB Geometry Music Man® chrome plated, stee... \n", + "\n", + " Scale Length ... \\\n", + "index ... \n", + "StingRay 5 35th Anniversary 34\" (86.4 cm) ... \n", + "StingRay Special Collection NaN ... \n", + "Short Scale StingRay 30\" (76.2 cm) ... \n", + "DarkRay NaN ... \n", + "Joe Dart Collection NaN ... \n", + "Tim Commerford 30\" (76.2 cm) ... \n", + "Bongo Collection NaN ... \n", + "John Myung 34\" (86.4 cm) ... \n", + "Mike Herrera 34\" (86.4 cm) ... \n", + "Sterling Collection NaN ... \n", + "Cliff Williams 34\" (86.4 cm) ... \n", + "\n", + " Electronic Shielding \\\n", + "index \n", + "StingRay 5 35th Anniversary Graphite acrylic resin coated body cavity and ... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Chrome plated aluminum control cover \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Chrome plated aluminum control cover \n", + "Bongo Collection NaN \n", + "John Myung Graphite acrylic resin coated body cavity and ... \n", + "Mike Herrera NaN \n", + "Sterling Collection NaN \n", + "Cliff Williams Chrome plated brass control cover & Copper Ins... \n", + "\n", + " Controls \\\n", + "index \n", + "StingRay 5 35th Anniversary 3-band active preamp with 18 volts of headroom... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Passive 500kohm push/push volume POT for gain ... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford 3-band active preamp with 18 volts of headroom... \n", + "Bongo Collection NaN \n", + "John Myung Volume \n", + "Mike Herrera 3 dummy knobs, pickup wired directly to jack \n", + "Sterling Collection NaN \n", + "Cliff Williams Custom 2-band active preamp; vol, treble, bass \n", + "\n", + " Switching \\\n", + "index \n", + "StingRay 5 35th Anniversary H: 3-way lever pickup selector; HH: 5-way leve... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay 3-way rotary pickup selector \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford NaN \n", + "Bongo Collection NaN \n", + "John Myung 5-way pickup blend knob \n", + "Mike Herrera NaN \n", + "Sterling Collection NaN \n", + "Cliff Williams NaN \n", + "\n", + " Pickups \\\n", + "index \n", + "StingRay 5 35th Anniversary Single or Dual Humbucking with Neodymium Magnets \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Single Music Man humbucking pickup- neodymium ... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Single Humbucking with Neodymium magnets \n", + "Bongo Collection NaN \n", + "John Myung Dual Humbucking with Neodymium magnets \n", + "Mike Herrera Music Man® humbucking with Alnico magnets \n", + "Sterling Collection NaN \n", + "Cliff Williams Custom humbucking with 8 elongated Alnico magnets \n", + "\n", + " Left Handed \\\n", + "index \n", + "StingRay 5 35th Anniversary No \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay No \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford NaN \n", + "Bongo Collection NaN \n", + "John Myung No \n", + "Mike Herrera no \n", + "Sterling Collection NaN \n", + "Cliff Williams No \n", + "\n", + " Strings \\\n", + "index \n", + "StingRay 5 35th Anniversary 46w-65w-80w-100w-130w (Regular Slinky Bass #2836) \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay 45w-65w-85w-105w (Short Scale Regular Slinky B... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford 45w-65w-85w-105w (Medium Scale Regular Slinky ... \n", + "Bongo Collection NaN \n", + "John Myung 32w-45w-65w-80w-100w-130w (Cobalt Bass) \n", + "Mike Herrera 50w-70w-85w-105w (Regular Slinky Bass #2832) \n", + "Sterling Collection NaN \n", + "Cliff Williams 50w-70w-85w-105w (Group II Flatwound #2804) \n", + "\n", + " Pickguard \\\n", + "index \n", + "StingRay 5 35th Anniversary NaN \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay NaN \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Black \n", + "Bongo Collection NaN \n", + "John Myung Black \n", + "Mike Herrera Engraved White Pearloid, 3-ply with black cent... \n", + "Sterling Collection NaN \n", + "Cliff Williams N/A \n", + "\n", + " Order Neck Binding Body Bindings \n", + "index \n", + "StingRay 5 35th Anniversary NaN NaN NaN \n", + "StingRay Special Collection NaN NaN NaN \n", + "Short Scale StingRay NaN NaN NaN \n", + "DarkRay NaN NaN NaN \n", + "Joe Dart Collection NaN NaN NaN \n", + "Tim Commerford NaN NaN NaN \n", + "Bongo Collection NaN NaN NaN \n", + "John Myung 1 N/A NaN \n", + "Mike Herrera NaN NaN NaN \n", + "Sterling Collection NaN NaN NaN \n", + "Cliff Williams NaN N/A N/A \n", + "\n", + "[11 rows x 32 columns]" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "products_df" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "products_df.to_csv(\"/Users/cross/OneDrive/Documentos/GitHub/project-data-extraction/bass_prods.csv\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/README.md b/README.md index dc8bae8..e0ed2bd 100644 --- a/README.md +++ b/README.md @@ -4,39 +4,13 @@ ## Overview -The goal of this project is for you to practice what you have learned in the APIs and Web Scraping chapter of this program. For this project, you will choose both an API to obtain data from and a web page to scrape. For the API portion of the project will need to make calls to your chosen API, successfully obtain a response, request data, convert it into a Pandas data frame, and export it as a CSV file. For the web scraping portion of the project, you will need to scrape the HTML from your chosen page, parse the HTML to extract the necessary information, and either save the results to a text (txt) file if it is text or into a CSV file if it is tabular data. +The goal of this project is to practice what I have learned in the APIs and Web Scraping chapter of this program. -**You will be working individually for this project**, but we'll be guiding you along the process and helping you as you go. Show us what you've got! +I tried at first workign with amazon and spotify API but ended up being blocked by both pages. Therefore, I ended doing an analysis of a bass webpage to see what will be the next bass I want to buy, their characteristics and what option suits me best. ---- - -## Technical Requirements - -The technical requirements for this project are as follows: - -* You must obtain data from an API using Python. -* You must scrape and clean HTML from a web page using Python. -* The results should be two files - one containing the tabular results of your API request and the other containing the results of your web page scrape. -* Your code should be saved in a Jupyter Notebook and your results should be saved in a folder named output. -* You should include a README.md file that describes the steps you took and your thought process for obtaining data from the API and web page. - -## Necessary Deliverables - -The following deliverables should be pushed to your Github repo for this chapter. - -* **A Jupyter Notebook (.ipynb) file** that contains the code used to work with your API and scrape your web page. -* **An output folder** containing the outputs of your API and scraping efforts. -* **A ``README.md`` file** containing a detailed explanation of your approach and code for retrieving data from the API and scraping the web page as well as your results, obstacles encountered, and lessons learned. - -## Suggested Ways to Get Started - -* **Find an API to work with** - a great place to start looking would be [API List](https://apilist.fun/) and [Public APIs](https://github.com/toddmotto/public-apis). If you need authorization for your chosen API, make sure to give yourself enough time for the service to review and accept your application. Have a couple back-up APIs chosen just in case! -* **Find a web page to scrape** and determine the content you would like to scrape from it - blogs and news sites are typically good candidates for scraping text content, and [Wikipedia](https://www.wikipedia.org/) is usually a good source for HTML tables (search for "list of..."). -* **Break the project down into different steps** - note the steps covered in the API and web scraping lessons, try to follow them, and make adjustments as you encounter the obstacles that are inevitable due to all APIs and web pages being different. -* **Use the tools in your tool kit** - your knowledge of intermediate Python as well as some of the things you've learned in previous chapters. This is a great way to start tying everything you've learned together! -* **Work through the lessons in class** & ask questions when you need to! Think about adding relevant code to your project each night, instead of, you know... _procrastinating_. -* **Commit early, commit often**, don’t be afraid of doing something incorrectly because you can always roll back to a previous version. -* **Consult documentation and resources provided** to better understand the tools you are using and how to accomplish what you want. +Since I had several attempts for this project there are improvements to be done for the version 2.0 of the bass analysis: +* Clean the database +* Access the contained links that have families within the basses ## Useful Resources diff --git a/amazon_webscrapping.csv b/amazon_webscrapping.csv deleted file mode 100644 index 1015e39..0000000 --- a/amazon_webscrapping.csv +++ /dev/null @@ -1,3 +0,0 @@ -N/AN/A, -N/A, -NA, diff --git a/amazonbasics.html b/amazonbasics.html deleted file mode 100644 index 458862e..0000000 --- a/amazonbasics.html +++ /dev/null @@ -1,1857 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Amazon.com.mx: Amazon Basics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- - - - -
- - - - - - - -
- - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - diff --git a/output.csv b/output.csv new file mode 100644 index 0000000..c426303 --- /dev/null +++ b/output.csv @@ -0,0 +1,119 @@ +index,href,Description,Color,Model,Size,Body Wood,Body Finish,Body Colors,Bridge,Scale Length,Neck Radius,Headstock Size,Frets,Neck Width,Neck Wood,Fingerboard,Fret Markers,Neck Finish,Neck Colors,Tuning Machines,Truss Rod,Neck Attachment,Electronic Shielding,Controls,Switching,Pickups,Left Handed,Strings,Pickguard,Order,Neck Binding,Body Bindings +StingRay 5 35th Anniversary,basses/stingray-5-35th-anniversary," +In 1987 Ernie Ball Music Man created the legendary StingRay 5 bass, setting the standard for the modern 5-string bass. The 35th Anniversary edition honors the timeless Ernie Ball Music Man design that has been used by some of the world’s most iconic bassists. The ash body features a spalted maple top with thin maple veneer and comes standard with a Spalted Sunburst finish. The roasted figured maple neck features an ebony fretboard, copper pearlescent block inlays and is finished in a high gloss for superb comfort and playability. High-output neodymium StingRay 5 pickups provide powerful low-end with a distinctive mid-range punch while the lightweight hardware delivers solid stability. Limited to 225 single-humbucker and 25 dual-humbucker models, every Anniversary StingRay 5 includes a certificate of authenticity. +"," + + + +Spalted Sunburst + + + +",StingRay 5 35th Anniversary,"13-3/8"" wide, 1-3/4"" thick, 45-3/4"" long (34.0 cm wide, 4.5 cm thick, 116.2 cm long)",Ash,High gloss polyester,Spalted Sunburst,"Standard - Music Man® Black plated, hardened steel bridge plate with stainless steel saddles","34"" (86.4 cm)","11"" (27.9 cm)","Only 9"" (22.9 cm) long","22 - High profile, wide, Stainless Steel","1-3/4"" (44.5 mm) at nut 2-3/4"""" (69.9 mm) at last fret",Select roasted maple,Ebony ,Copper Pearloid Atlante Blocks,High gloss polyester,Natural,"Custom Music Man, lightweight with tapered string posts and ergonomic clover design",Adjustable - no component or string removal,"5 bolt, sculpted neck joint",Graphite acrylic resin coated body cavity and aluminum control cover,"3-band active preamp with 18 volts of headroom; vol, treble, mid, bass",H: 3-way lever pickup selector; HH: 5-way lever pickup selector,Single or Dual Humbucking with Neodymium Magnets,No,46w-65w-80w-100w-130w (Regular Slinky Bass #2836),,,, +StingRay Special Collection,families/basses/stingray-special,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Short Scale StingRay,basses/short-scale-stingray," +The Ernie Ball Music Man Short Scale StingRay bass offers a big thumpy round sound in a convenient smaller package. A 30” scale allows for easier playability due to the shorter spacing between the frets. The Ernie Ball Music Man passive humbucking pickup, equipped with higher output neodymium magnets, has been specially designed for the short scale bass, providing its signature warm tone. The electronics package includes a 3-way rotary switch featuring parallel, true single-coil, and series modes. Like its big brother, the Stingray Special, the short scale bass comes standard with a modern classic bridge, 22 stainless steel frets, and new lightweight Music Man tuning machines with a finer gear ratio. +"," + + + +Candy Man + + + + + + +Burnt Ends + + + + + + +Vincent Blue + + + + + + +Silver Shadow + + + + + + +Plum Crazy + + + +",Short Scale StingRay Bass,"12-3/8"" wide, 1-5/8"" thick, 40-7/8"" long (31.4 cm wide, 4.1 cm thick, 103.8 cm long)",Ash,High gloss polyester,,"Vintage Music Man® top loaded chrome plated, steel bridge plate with vintage nickel plated steel saddles","30"" (76.2 cm)",,,"22 - High profile, wide stainless steel","1-1/2"" (38.1 mm) at the nut, 2-3/8"" (60.3 cm) at the last fret",Select Maple,,"5/16"" Dot Inlay",Gunstock oil and hand-rubbed special wax blend,,"Custom Music Man, lightweight with tapered string posts and ergonomic clover design",Adjustable - no component or string removal,"5 bolt, sculpted neck joint",Chrome plated aluminum control cover,"Passive 500kohm push/push volume POT for gain boost, 100kohm tone POT - 0.1uf tone cap",3-way rotary pickup selector ,Single Music Man humbucking pickup- neodymium magnets,No,45w-65w-85w-105w (Short Scale Regular Slinky Bass #2852),,,, +DarkRay,families/basses/darkray,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Joe Dart Collection,families/basses/joe-dart,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Tim Commerford,basses/tim-commerford," +Welcome to the Tim Commerford Artist Series StingRay collection. These brand-new limited-edition Ernie Ball Music Man instruments were designed in conjunction with Tim Commerford, the legendary bassist of Rage Against the Machine, Audioslave, and his newest project, 7D7D. Tim has been a part of the Ernie Ball Music Man family for many years, and this collaboration is the natural evolution of his enduring passion for the StingRay bass. With active and passive options for both short-scale and full-scale, you’re sure to find the right match for your playing style. The passive full-scale and active short-scale models deserve special consideration, as Music Man has never before offered these configurations. + +Over the last 30 years, Commerford has perfected his signature sound, playing many passive and active basses. The ability to have both full and short-scale, active and passive basses in one collection gives Tim the tools required to reproduce the sounds made famous throughout his career. +"," + + + +Black Full-Scale (Active) + + + + + + +Natural Full-Scale (Passive) + + + +",Tim Commerford Active Short-Scale,"12-3/8"" wide, 1-5/8"" thick, 40-7/8"" long (31.4 cm wide, 4.1 cm thick, 103.8 cm long)",Ash,High gloss polyester,Natural Gloss,"Music Man® chrome plated, strings-thru-the-body & hardened steel bridge plate with vintage nickel plated steel saddles and adjustable mute pads","30"" (76.2 cm)","11"" (27.9 cm)","8"" (20.3 cm) long","22 - High profile, wide stainless steel","1-1/2"" (38.1 mm) at the nut, 2-3/8"" (60.3 cm) at the last fret",Select Maple,Maple,"5/16"" Dot Inlay",Gunstock oil and hand-rubbed special wax blend,,"Custom Music Man, lightweight with tapered string posts and ergonomic clover design",,"5 bolt, sculpted neck joint",Chrome plated aluminum control cover,"3-band active preamp with 18 volts of headroom; vol, treble, mid, bass",,Single Humbucking with Neodymium magnets,,45w-65w-85w-105w (Medium Scale Regular Slinky Bass #2856),Black,,, +Bongo Collection,families/basses/bongo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +John Myung,basses/john-myung," +The John Myung artist series Bongo is a sleek, ultra-modern 6 string bass crafted and perfected to John's exacting specifications. +With over a decade long refinement process, John and the Ernie Ball Music Man engineering team have addressed a multitude of design features to further enhance comfortability, playability, and overall performance. Some key features include a simplified control layout with preprogrammed equalization, a perfectly balanced compact basswood body mated to a maple neck with 5 string nut width for tighter string spacing, and a golden ratio fretboard utilizing a combination of rosewood and roasted maple for an elegant aesthetic. This instrument is truly an artist inspired design that facilitates John's needs as a performance artist and master technician. +"," + + + +Platinum Silver + + + + + + +Black + + + +",John Myung Bongo 6 HH,"12-3/4"" wide, 1-5/8"" thick, 47-5/8"" long (32.4 cm wide, 4.1 cm thick, 121.0 cm long)",Basswood,High gloss polyester,Black,"Music Man® chrome plated, steel bridge plate with stainless steel saddles","34"" (86.4 cm)","11"" (27.9 cm)","Only 9-3/4"" (24.8 cm) long","24 - High profile, wide","1-3/4"" (44.5 mm) at nut 2-13/16"" (71.4 mm) at last fret",Roasted Maple Neck,Rosewood/Roasted Maple,White Half moon inlay,Oil and Wax,Natural,"Custom Music Man, lightweight with tapered string posts and ergonomic design",,"5 bolt, sculpted neck joint",Graphite acrylic resin coated body cavity and aluminum control cover,Volume,5-way pickup blend knob,Dual Humbucking with Neodymium magnets,No,32w-45w-65w-80w-100w-130w (Cobalt Bass),Black,1,N/A, +Mike Herrera,basses/mike-herrera," +Introducing the Ernie Ball Music Man Mike Herrera StingRay bass. For more than two decades MXPX frontman and bassist Mike Herrera has wielded a custom StingRay, modified to his unique specifications. Now, Herrera’s secret weapon is available to the public. The Mike Herrera StingRay features an ash body with Seafoam Green finish, a matching headstock, an engraved white pearloid pickguard, passive electronics (no battery required), and a custom laser engraved Artist Series neckplate. Having the appearance of a traditional 2-band EQ StingRay, the Herrera StingRay's pickup is actually wired straight to the jack with three dummy knobs. Additional features include a maple neck and fretboard, 21 nickel frets, six bolt neck, and alnico magnets. +"," + + + +Seafoam Green + + + +",Mike Herrera StingRay Bass,"13-1/2"" wide x 1-5/8"" thick x 44-7/8"" long (34.3 cm wide, 4.1 cm thick, 114.0 cm long)",Ash,High gloss polyester,Seafoam Green,"Music Man® Chrome plated, hardened steel bridge plate with stainless steel saddles","34"" (86.4 cm)","11"" (27.9 cm)",,"21 high profile wide, nickel silver","1-11/16"" (42.9mm) at nut, 2-1/2"" (63.5 mm) at last fret",Maple,Maple,Dot inlay,Gunstock oil and hand-rubbed special wax blend,Natural,"Schaller BM, with tapered string posts",,6 bolts - perfect alignment with no shifting,,"3 dummy knobs, pickup wired directly to jack",,Music Man® humbucking with Alnico magnets,no,50w-70w-85w-105w (Regular Slinky Bass #2832),"Engraved White Pearloid, 3-ply with black center layer",,, +Sterling Collection,families/basses/sterling,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cliff Williams,basses/cliff-williams," +The all-new Cliff Williams Icon Series StingRay Bass is the first in a series of limited handcrafted replicas made to capture the look, sound, and essence of iconic Music Man instruments. Initially dubbed “The #1 Workhorse,” Cliff's 1979 Stingray has been his favorite bass for more than 40 years. Built to the exacting specifications of his original, every detail and characteristic was carefully examined and addressed. Body contours, neck carve, pickup construction, and decades of wear and tear were dutifully replicated by Music Man’s team of master craftsmen. The resulting outcome is a finely crafted period-correct instrument that looks, feels, and sounds just like Cliff’s #1 Stingray bass. +Only 26 available worldwide. +Listen to our podcast episode with Cliff Williams and Ernie Ball Music Man engineer Blair Ridings. +"," + + + +Back in Burst + + + +",Cliff Williams StingRay,"13-1/2"" wide x 1-5/8"" thick x 44-7/8"" long (34.3 cm wide, 4.1 cm thick, 114.0 cm long)",3-Piece Trans Poplar,Nitrocellulose Lacquer,Back in Burst,"Pre-EB Geometry Music Man® chrome plated, steel bridge plate with vintage stainless steel saddles","34"" (86.4 cm)","7.5"" (19.1 cm)","8-3/4"" (22.2 cm) long","21 - Low profile, wide","2-1/2"" (63.5 mm)",Select maple neck,Natural aged light yellow finish,"5/16"" Dot Inlay",Nitrocellulose Lacquer,Natural aged light yellow finish,"Schaller BM, with tapered string posts",,"3 Bolt, Pre EB Music Man Design with Micro-Tilt Neck Shim Adjustment",Chrome plated brass control cover & Copper Insulating Tape in Control Cavity,"Custom 2-band active preamp; vol, treble, bass",,Custom humbucking with 8 elongated Alnico magnets,No,50w-70w-85w-105w (Group II Flatwound #2804),N/A,,N/A,N/A diff --git a/webscrapping.ipynb b/webscrapping.ipynb index a8453c7..cdb9611 100644 --- a/webscrapping.ipynb +++ b/webscrapping.ipynb @@ -1,290 +1,885 @@ { "cells": [ { - "cell_type": "code", - "execution_count": 224, - "id": "7a65bb85-4064-4b76-8de8-175a40bcaf4c", + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "from bs4 import BeautifulSoup\n", - "import requests\n", - "import pandas as pd" + "## Modules" ] }, { "cell_type": "code", - "execution_count": 188, - "id": "ab5e8826-aa27-43df-9335-2e500a3ed303", + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ - "amazonfile= open('amazon_webscrapping.csv','a')" + "from bs4 import BeautifulSoup\n", + "import requests\n", + "import pandas as pd" ] }, { - "cell_type": "code", - "execution_count": 202, - "id": "e6890df5-f08c-4ad0-8497-a3c22070d4dd", + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "colnames = ['ITEM', 'PRICE','RATING'] " + "## Variables" ] }, { "cell_type": "code", - "execution_count": 220, - "id": "f8fabf91-9e2d-4b90-882f-444309b1917a", + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "data = pd.read_csv('amazon_webscrapping.csv', names=colnames, header=None)" + "stingray_url = 'https://www.music-man.com/instruments/'\n", + "basses_url = 'https://www.music-man.com/instruments/basses/'" ] }, { "cell_type": "markdown", - "id": "47361423-98c2-427c-9a43-500741287da1", "metadata": {}, "source": [ - "# Authentication" + "## Get data" ] }, { "cell_type": "markdown", - "id": "4d7caf16-671c-4e47-bd1d-19a371a854f0", "metadata": {}, "source": [ - "Check price of one article (iphone 14)" + "### Make the call" ] }, { "cell_type": "code", - "execution_count": 148, - "id": "d3104c26-edcd-4ed0-b9ff-7f120ae63fd6", + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ - "URL = 'https://www.amazon.com.mx/AmazonBasics-Cama-para-perro-redonda/dp/B07233P1W2?ref_=ast_sto_dp&th=1&psc=1'" + "response = requests.get(basses_url)\n", + "content = BeautifulSoup(response.content,'lxml')" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "491fdf5c-cf0f-45de-aaf4-1a975a64438c", + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "##crear logicas de for i in URL que el programa agarre cada url y vaya construyendo la tabla en vez de copiar y pegar el url de manera manual. \n", - "#checar como hacer esto!" + "### Obtain the products" ] }, { "cell_type": "code", - "execution_count": 149, - "id": "366f147d-e335-463f-9568-1c89ec9a84d2", + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ - "headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'\n", - "}" + "products = content.find('section', {'class': 'guitar-bg'}).find_all('div', {'class': 'guitar-imgs text-center'})" ] }, { - "cell_type": "code", - "execution_count": 150, - "id": "0ef22c3e-5a14-4854-9daf-32be616e2a7c", + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "response = requests.get(URL, headers=headers)" + "For each product, get the name and url" ] }, { "cell_type": "code", - "execution_count": 151, - "id": "123c610f-0061-424c-9e0a-9f8eba488781", + "execution_count": 5, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "200\n" - ] - } - ], + "outputs": [], "source": [ - "print(response.status_code)" + "products_dict = {}\n", + "\n", + "for product in products:\n", + " \n", + " product = product.find('a', {'class': 'the-steve'})\n", + " products_dict[product.text] = [product.attrs['href']]" ] }, { - "cell_type": "code", - "execution_count": 192, - "id": "a8e10dae-f975-42d3-b3c8-c91a05dda162", + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "content = BeautifulSoup(response.content,'lxml')" + "Convert to DF to manipulate it more easily" ] }, { "cell_type": "code", - "execution_count": 193, - "id": "11d1dbba-c7f9-4726-875a-fdec007ffb42", + "execution_count": 6, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "bs4.BeautifulSoup" - ] - }, - "execution_count": 193, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "type(content)" + "products_df = pd.DataFrame(products_dict).transpose()\n", + "products_df.columns = ['href']\n", + "products_df.index = products_df.reset_index()['index'].apply(lambda x : x.split('\\n')[1])" ] }, { "cell_type": "markdown", - "id": "0558775c-04f6-4372-9fa3-53b55b79ef5e", "metadata": {}, "source": [ - "# Get data" + "At the moment, we only have the url to the instrument" ] }, { "cell_type": "code", - "execution_count": 223, - "id": "2eb6ae12-4ec0-42e0-96ca-c7e8e0a25436", - "metadata": {}, - "outputs": [], - "source": [ - "#product title\n", - "try:\n", - " title = content.find_all('span',{'id': 'productTitle'}).get_text\n", - " title = title.strip()[1:].replace(',', '')\n", - "except AttributeError:\n", - " title = ''" - ] - }, - { - "cell_type": "code", - "execution_count": 215, - "id": "5ade6aeb-360b-4ff7-9742-d907d5ecf1be", + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
href
index
StingRay 5 35th Anniversarybasses/stingray-5-35th-anniversary
StingRay Special Collectionfamilies/basses/stingray-special
Short Scale StingRaybasses/short-scale-stingray
DarkRayfamilies/basses/darkray
Joe Dart Collectionfamilies/basses/joe-dart
\n", + "
" + ], "text/plain": [ - "1" + " href\n", + "index \n", + "StingRay 5 35th Anniversary basses/stingray-5-35th-anniversary\n", + "StingRay Special Collection families/basses/stingray-special\n", + "Short Scale StingRay basses/short-scale-stingray\n", + "DarkRay families/basses/darkray\n", + "Joe Dart Collection families/basses/joe-dart" ] }, - "execution_count": 215, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "#saving the title\n", - "amazonfile.write(f'{title}\\n')" + "products_df.head()" ] }, { - "cell_type": "code", - "execution_count": 216, - "id": "268a5fa1-47d4-45c0-bfef-fb94b90e6474", + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "#product price\n", - "try:\n", - " price = content.find_all('span',{'class': 'a-price-whole'})\n", - " price = price.strip().replace(',', '')\n", - "except AttributeError:\n", - " price = ''" + "### Obtain info per product" ] }, { "cell_type": "code", - "execution_count": 217, - "id": "d85ce0bd-3287-4744-a42e-108fd5a6d7ab", + "execution_count": 8, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "1" - ] - }, - "execution_count": 217, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "Getting info for StingRay 5 35th Anniversary ...\n", + "Getting info for StingRay Special Collection ...\n", + "Getting info for Short Scale StingRay ...\n", + "Getting info for DarkRay ...\n", + "Getting info for Joe Dart Collection ...\n", + "Getting info for Tim Commerford ...\n", + "Getting info for Bongo Collection ...\n", + "Getting info for John Myung ...\n", + "Getting info for Mike Herrera ...\n", + "Getting info for Sterling Collection ...\n", + "Getting info for Cliff Williams ...\n" + ] } ], "source": [ - "#saving the price\n", - "amazonfile.write(f'{price}\\n')" + "for name, url in zip(products_df['href'].index, products_df['href']):\n", + " \n", + " print(f'Getting info for {name} ...')\n", + " \n", + " # make the call to the url\n", + " response = requests.get(stingray_url + url)\n", + " content = BeautifulSoup(response.content,'lxml')\n", + " \n", + " # Some will fail since they are not pages that contain individdual basses, but rather\n", + " # redirect to more pages with more basses. An improvement to this project would be to explore those cases later\n", + " try:\n", + " products_df.loc[name, 'Description'] = content.find('p', {'class': 'instrument-desc'}).text\n", + " except AttributeError:\n", + " continue\n", + " \n", + " # Get the color\n", + " products_df.loc[name, 'Color'] = content.find('div', {'class': 'color-set row active'}).text\n", + " \n", + " # There are many specs contained in a table. Asign a column to each\n", + " columns = content.find_all('td', {'class': 'text-right'})\n", + " columns = [aux.text for aux in columns]\n", + " # This was done since there are some other values that, instead of being specs, are more\n", + " # like comparisons with other basses. Drop tse.\n", + " where_to_end = [1 if aux == 'Strings' else 0 for aux in columns ]\n", + " where_to_end = where_to_end.index(1) + 1\n", + " columns = columns[:where_to_end]\n", + "\n", + " # We get the values for each of the specs\n", + " values = content.find_all('td', {'class': 'text-left'})\n", + " values = [aux.text for aux in values]\n", + " values = values[:where_to_end]\n", + " \n", + " # And assign them to the DF\n", + " for column, value in zip(columns, values):\n", + " products_df.loc[name, column] = value" ] }, { - "cell_type": "code", - "execution_count": 218, - "id": "64c6b2ab-fee7-450d-8aad-84badb67509c", + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "#product rating\n", - "try:\n", - " rating = content.find('i', {'class': 'a-icon a-icon-star a-star-4-5'}).text\n", - " rating = rating.strip().replace(',', '')\n", - "except AttributeError:\n", - " try:\n", - " rating = content.find(\"span\", {'class': 'a-icon-alt'}).string.strip().replace(',', '')\n", - " except:\n", - " rating = ''" + "We can see that some url did not go through. This is because they have `families/` in them. When we look at these links, they each still have more independent links that can be accessed. Thus, for each of these ones, we could explore all the sublinks and get data for every bass." ] }, { "cell_type": "code", - "execution_count": 219, - "id": "1e5979e2-8214-49e1-92a9-0ced3c6388f9", + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
hrefDescriptionColorModelSizeBody WoodBody FinishBody ColorsBridgeScale Length...Electronic ShieldingControlsSwitchingPickupsLeft HandedStringsPickguardOrderNeck BindingBody Bindings
index
StingRay 5 35th Anniversarybasses/stingray-5-35th-anniversary\\nIn 1987 Ernie Ball Music Man created the leg...\\n\\n\\n\\nSpalted Sunburst\\n\\n\\n\\nStingRay 5 35th Anniversary13-3/8\" wide, 1-3/4\" thick, 45-3/4\" long (34.0...AshHigh gloss polyesterSpalted SunburstStandard - Music Man® Black plated, hardened s...34\" (86.4 cm)...Graphite acrylic resin coated body cavity and ...3-band active preamp with 18 volts of headroom...H: 3-way lever pickup selector; HH: 5-way leve...Single or Dual Humbucking with Neodymium MagnetsNo46w-65w-80w-100w-130w (Regular Slinky Bass #2836)NaNNaNNaNNaN
StingRay Special Collectionfamilies/basses/stingray-specialNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Short Scale StingRaybasses/short-scale-stingray\\nThe Ernie Ball Music Man Short Scale StingRa...\\n\\n\\n\\nCandy Man\\n\\n\\n\\n\\n\\n\\nBurnt Ends\\n\\n\\...Short Scale StingRay Bass12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4...AshHigh gloss polyesterNaNVintage Music Man® top loaded chrome plated, s...30\" (76.2 cm)...Chrome plated aluminum control coverPassive 500kohm push/push volume POT for gain ...3-way rotary pickup selectorSingle Music Man humbucking pickup- neodymium ...No45w-65w-85w-105w (Short Scale Regular Slinky B...NaNNaNNaNNaN
DarkRayfamilies/basses/darkrayNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Joe Dart Collectionfamilies/basses/joe-dartNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Tim Commerfordbasses/tim-commerford\\nWelcome to the Tim Commerford Artist Series ...\\n\\n\\n\\nBlack Full-Scale (Active)\\n\\n\\n\\n\\n\\n\\...Tim Commerford Active Short-Scale12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4...AshHigh gloss polyesterNatural GlossMusic Man® chrome plated, strings-thru-the-bod...30\" (76.2 cm)...Chrome plated aluminum control cover3-band active preamp with 18 volts of headroom...NaNSingle Humbucking with Neodymium magnetsNaN45w-65w-85w-105w (Medium Scale Regular Slinky ...BlackNaNNaNNaN
Bongo Collectionfamilies/basses/bongoNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
John Myungbasses/john-myung\\nThe John Myung artist series Bongo is a slee...\\n\\n\\n\\nPlatinum Silver\\n\\n\\n\\n\\n\\n\\nBlack\\n\\n...John Myung Bongo 6 HH12-3/4\" wide, 1-5/8\" thick, 47-5/8\" long (32.4...BasswoodHigh gloss polyesterBlackMusic Man® chrome plated, steel bridge plate w...34\" (86.4 cm)...Graphite acrylic resin coated body cavity and ...Volume5-way pickup blend knobDual Humbucking with Neodymium magnetsNo32w-45w-65w-80w-100w-130w (Cobalt Bass)Black1N/ANaN
Mike Herrerabasses/mike-herrera\\nIntroducing the Ernie Ball Music Man Mike He...\\n\\n\\n\\nSeafoam Green\\n\\n\\n\\nMike Herrera StingRay Bass13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34...AshHigh gloss polyesterSeafoam GreenMusic Man® Chrome plated, hardened steel bridg...34\" (86.4 cm)...NaN3 dummy knobs, pickup wired directly to jackNaNMusic Man® humbucking with Alnico magnetsno50w-70w-85w-105w (Regular Slinky Bass #2832)Engraved White Pearloid, 3-ply with black cent...NaNNaNNaN
Sterling Collectionfamilies/basses/sterlingNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Cliff Williamsbasses/cliff-williams\\nThe all-new Cliff Williams Icon Series Sting...\\n\\n\\n\\nBack in Burst\\n\\n\\n\\nCliff Williams StingRay13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34...3-Piece Trans PoplarNitrocellulose LacquerBack in BurstPre-EB Geometry Music Man® chrome plated, stee...34\" (86.4 cm)...Chrome plated brass control cover & Copper Ins...Custom 2-band active preamp; vol, treble, bassNaNCustom humbucking with 8 elongated Alnico magnetsNo50w-70w-85w-105w (Group II Flatwound #2804)N/ANaNN/AN/A
\n", + "

11 rows × 32 columns

\n", + "
" + ], "text/plain": [ - "1" + " href \\\n", + "index \n", + "StingRay 5 35th Anniversary basses/stingray-5-35th-anniversary \n", + "StingRay Special Collection families/basses/stingray-special \n", + "Short Scale StingRay basses/short-scale-stingray \n", + "DarkRay families/basses/darkray \n", + "Joe Dart Collection families/basses/joe-dart \n", + "Tim Commerford basses/tim-commerford \n", + "Bongo Collection families/basses/bongo \n", + "John Myung basses/john-myung \n", + "Mike Herrera basses/mike-herrera \n", + "Sterling Collection families/basses/sterling \n", + "Cliff Williams basses/cliff-williams \n", + "\n", + " Description \\\n", + "index \n", + "StingRay 5 35th Anniversary \\nIn 1987 Ernie Ball Music Man created the leg... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay \\nThe Ernie Ball Music Man Short Scale StingRa... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford \\nWelcome to the Tim Commerford Artist Series ... \n", + "Bongo Collection NaN \n", + "John Myung \\nThe John Myung artist series Bongo is a slee... \n", + "Mike Herrera \\nIntroducing the Ernie Ball Music Man Mike He... \n", + "Sterling Collection NaN \n", + "Cliff Williams \\nThe all-new Cliff Williams Icon Series Sting... \n", + "\n", + " Color \\\n", + "index \n", + "StingRay 5 35th Anniversary \\n\\n\\n\\nSpalted Sunburst\\n\\n\\n\\n \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay \\n\\n\\n\\nCandy Man\\n\\n\\n\\n\\n\\n\\nBurnt Ends\\n\\n\\... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford \\n\\n\\n\\nBlack Full-Scale (Active)\\n\\n\\n\\n\\n\\n\\... \n", + "Bongo Collection NaN \n", + "John Myung \\n\\n\\n\\nPlatinum Silver\\n\\n\\n\\n\\n\\n\\nBlack\\n\\n... \n", + "Mike Herrera \\n\\n\\n\\nSeafoam Green\\n\\n\\n\\n \n", + "Sterling Collection NaN \n", + "Cliff Williams \\n\\n\\n\\nBack in Burst\\n\\n\\n\\n \n", + "\n", + " Model \\\n", + "index \n", + "StingRay 5 35th Anniversary StingRay 5 35th Anniversary \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Short Scale StingRay Bass \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Tim Commerford Active Short-Scale \n", + "Bongo Collection NaN \n", + "John Myung John Myung Bongo 6 HH \n", + "Mike Herrera Mike Herrera StingRay Bass \n", + "Sterling Collection NaN \n", + "Cliff Williams Cliff Williams StingRay \n", + "\n", + " Size \\\n", + "index \n", + "StingRay 5 35th Anniversary 13-3/8\" wide, 1-3/4\" thick, 45-3/4\" long (34.0... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay 12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford 12-3/8\" wide, 1-5/8\" thick, 40-7/8\" long (31.4... \n", + "Bongo Collection NaN \n", + "John Myung 12-3/4\" wide, 1-5/8\" thick, 47-5/8\" long (32.4... \n", + "Mike Herrera 13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34... \n", + "Sterling Collection NaN \n", + "Cliff Williams 13-1/2\" wide x 1-5/8\" thick x 44-7/8\" long (34... \n", + "\n", + " Body Wood Body Finish \\\n", + "index \n", + "StingRay 5 35th Anniversary Ash High gloss polyester \n", + "StingRay Special Collection NaN NaN \n", + "Short Scale StingRay Ash High gloss polyester \n", + "DarkRay NaN NaN \n", + "Joe Dart Collection NaN NaN \n", + "Tim Commerford Ash High gloss polyester \n", + "Bongo Collection NaN NaN \n", + "John Myung Basswood High gloss polyester \n", + "Mike Herrera Ash High gloss polyester \n", + "Sterling Collection NaN NaN \n", + "Cliff Williams 3-Piece Trans Poplar Nitrocellulose Lacquer \n", + "\n", + " Body Colors \\\n", + "index \n", + "StingRay 5 35th Anniversary Spalted Sunburst \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay NaN \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Natural Gloss \n", + "Bongo Collection NaN \n", + "John Myung Black \n", + "Mike Herrera Seafoam Green \n", + "Sterling Collection NaN \n", + "Cliff Williams Back in Burst \n", + "\n", + " Bridge \\\n", + "index \n", + "StingRay 5 35th Anniversary Standard - Music Man® Black plated, hardened s... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Vintage Music Man® top loaded chrome plated, s... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Music Man® chrome plated, strings-thru-the-bod... \n", + "Bongo Collection NaN \n", + "John Myung Music Man® chrome plated, steel bridge plate w... \n", + "Mike Herrera Music Man® Chrome plated, hardened steel bridg... \n", + "Sterling Collection NaN \n", + "Cliff Williams Pre-EB Geometry Music Man® chrome plated, stee... \n", + "\n", + " Scale Length ... \\\n", + "index ... \n", + "StingRay 5 35th Anniversary 34\" (86.4 cm) ... \n", + "StingRay Special Collection NaN ... \n", + "Short Scale StingRay 30\" (76.2 cm) ... \n", + "DarkRay NaN ... \n", + "Joe Dart Collection NaN ... \n", + "Tim Commerford 30\" (76.2 cm) ... \n", + "Bongo Collection NaN ... \n", + "John Myung 34\" (86.4 cm) ... \n", + "Mike Herrera 34\" (86.4 cm) ... \n", + "Sterling Collection NaN ... \n", + "Cliff Williams 34\" (86.4 cm) ... \n", + "\n", + " Electronic Shielding \\\n", + "index \n", + "StingRay 5 35th Anniversary Graphite acrylic resin coated body cavity and ... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Chrome plated aluminum control cover \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Chrome plated aluminum control cover \n", + "Bongo Collection NaN \n", + "John Myung Graphite acrylic resin coated body cavity and ... \n", + "Mike Herrera NaN \n", + "Sterling Collection NaN \n", + "Cliff Williams Chrome plated brass control cover & Copper Ins... \n", + "\n", + " Controls \\\n", + "index \n", + "StingRay 5 35th Anniversary 3-band active preamp with 18 volts of headroom... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Passive 500kohm push/push volume POT for gain ... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford 3-band active preamp with 18 volts of headroom... \n", + "Bongo Collection NaN \n", + "John Myung Volume \n", + "Mike Herrera 3 dummy knobs, pickup wired directly to jack \n", + "Sterling Collection NaN \n", + "Cliff Williams Custom 2-band active preamp; vol, treble, bass \n", + "\n", + " Switching \\\n", + "index \n", + "StingRay 5 35th Anniversary H: 3-way lever pickup selector; HH: 5-way leve... \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay 3-way rotary pickup selector \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford NaN \n", + "Bongo Collection NaN \n", + "John Myung 5-way pickup blend knob \n", + "Mike Herrera NaN \n", + "Sterling Collection NaN \n", + "Cliff Williams NaN \n", + "\n", + " Pickups \\\n", + "index \n", + "StingRay 5 35th Anniversary Single or Dual Humbucking with Neodymium Magnets \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay Single Music Man humbucking pickup- neodymium ... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Single Humbucking with Neodymium magnets \n", + "Bongo Collection NaN \n", + "John Myung Dual Humbucking with Neodymium magnets \n", + "Mike Herrera Music Man® humbucking with Alnico magnets \n", + "Sterling Collection NaN \n", + "Cliff Williams Custom humbucking with 8 elongated Alnico magnets \n", + "\n", + " Left Handed \\\n", + "index \n", + "StingRay 5 35th Anniversary No \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay No \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford NaN \n", + "Bongo Collection NaN \n", + "John Myung No \n", + "Mike Herrera no \n", + "Sterling Collection NaN \n", + "Cliff Williams No \n", + "\n", + " Strings \\\n", + "index \n", + "StingRay 5 35th Anniversary 46w-65w-80w-100w-130w (Regular Slinky Bass #2836) \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay 45w-65w-85w-105w (Short Scale Regular Slinky B... \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford 45w-65w-85w-105w (Medium Scale Regular Slinky ... \n", + "Bongo Collection NaN \n", + "John Myung 32w-45w-65w-80w-100w-130w (Cobalt Bass) \n", + "Mike Herrera 50w-70w-85w-105w (Regular Slinky Bass #2832) \n", + "Sterling Collection NaN \n", + "Cliff Williams 50w-70w-85w-105w (Group II Flatwound #2804) \n", + "\n", + " Pickguard \\\n", + "index \n", + "StingRay 5 35th Anniversary NaN \n", + "StingRay Special Collection NaN \n", + "Short Scale StingRay NaN \n", + "DarkRay NaN \n", + "Joe Dart Collection NaN \n", + "Tim Commerford Black \n", + "Bongo Collection NaN \n", + "John Myung Black \n", + "Mike Herrera Engraved White Pearloid, 3-ply with black cent... \n", + "Sterling Collection NaN \n", + "Cliff Williams N/A \n", + "\n", + " Order Neck Binding Body Bindings \n", + "index \n", + "StingRay 5 35th Anniversary NaN NaN NaN \n", + "StingRay Special Collection NaN NaN NaN \n", + "Short Scale StingRay NaN NaN NaN \n", + "DarkRay NaN NaN NaN \n", + "Joe Dart Collection NaN NaN NaN \n", + "Tim Commerford NaN NaN NaN \n", + "Bongo Collection NaN NaN NaN \n", + "John Myung 1 N/A NaN \n", + "Mike Herrera NaN NaN NaN \n", + "Sterling Collection NaN NaN NaN \n", + "Cliff Williams NaN N/A N/A \n", + "\n", + "[11 rows x 32 columns]" ] }, - "execution_count": 219, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "#saving the rating\n", - "amazonfile.write(f'{rating}\\n')" + "products_df" ] }, { "cell_type": "code", - "execution_count": 182, - "id": "1cd392f5-ad28-4075-8af8-f039569138cc", + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ - "amazonfile.close()" + "products_df.to_csv(\"/Users/cross/OneDrive/Documentos/GitHub/project-data-extraction/bass_prods.csv\")" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -298,7 +893,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.8.5" } }, "nbformat": 4, From cb64c1017d733245234b363d294aec5944ac36ec Mon Sep 17 00:00:00 2001 From: LuciaGPalos Date: Fri, 2 Dec 2022 19:13:34 -0600 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0ed2bd..d3867cc 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Since I had several attempts for this project there are improvements to be done * Access the contained links that have families within the basses ## Useful Resources - +* [Bass Specialized Webpage](https://www.music-man.com/instruments/basses/) * [Requests Library Documentation: Quickstart](http://docs.python-requests.org/en/master/user/quickstart/) * [BeautifulSoup Documentation](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) * [Stack Overflow Python Requests Questions](https://stackoverflow.com/questions/tagged/python-requests)