with whiskynote.be data

Author

Tony Duan

Code
import requests
import os
from bs4 import BeautifulSoup
import pandas as pd
import time
Code
os.system('pip show beautifulsoup4')
Name: beautifulsoup4
Version: 4.13.3
Summary: Screen-scraping library
Home-page: https://www.crummy.com/software/BeautifulSoup/bs4/
Author: 
Author-email: Leonard Richardson <leonardr@segfault.org>
License: MIT License
Location: /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages
Requires: soupsieve, typing-extensions
Required-by: nbconvert
0

Web scraping on www.whiskynotes.be

1 review page

Code
review_url='https://www.whiskynotes.be/2024/ardbeg/spheric-spirits-springbank-blended-malt-islay-malt/'

2 read in html

Code
# Send an HTTP GET request to the website
headers = {'User-Agent': 'My User Agent'}
response = requests.get(review_url,headers=headers)
Code
# success code - 200 
print(response) 
<Response [200]>
Code
#print(response.content)
Code
# Parse the HTML code using BeautifulSoup
soup = BeautifulSoup(response.content, 'html.parser')
Code
#print(soup.prettify())
Code
soup.title
<title>Spheric Spirits: Springbank / Blended Malt / Islay Malt</title>
Code
soup.p
<p><strong>Spheric Spirits</strong> is a young indie bottler from Germany, started by Benedict and Claudio. They have a slightly edgy / flashy branding (check <a href="https://sphericspirits.com/" rel="noopener" target="_blank">the website</a>) – I like the vibrant colours on the labels but apparently not everything agrees. Besides whisky, they’re also looking at armagnac and <em>destilado de agave</em>. They’re not just bottlers, by the way, they like to get involved at the beginning of production.</p>
Code
soup.find_all('.entry-content h2')
[]

3 take picture of url

4 bottle_name

Code
bottle_name=soup.find_all('h2',class_="product-main__name")
bottle_name
[<h2 class="product-main__name">Blended Malt 44 yo 1978 (59,8%, Spheric Spirits 2023, refill sherry butt #6, 331 btl.)</h2>,
 <h2 class="product-main__name">Springbank 27 yo 1994 (47,1%, Spheric Spirits 2022, refill sherry hogshead #95, 241 btl.)</h2>,
 <h2 class="product-main__name">Islay Malt 25 yo (48,4%, Spheric Spirits 2022, 407 btl.)</h2>]
Code
bottle_name2=[]

for i in bottle_name:
  name=i.text
  bottle_name2.append(name)

bottle_name2
['Blended Malt 44 yo 1978 (59,8%, Spheric Spirits 2023, refill sherry butt #6, 331 btl.)',
 'Springbank 27 yo 1994 (47,1%, Spheric Spirits 2022, refill sherry hogshead #95, 241 btl.)',
 'Islay Malt 25 yo (48,4%, Spheric Spirits 2022, 407 btl.)']

5 bottle_review

6 bottle_review_Nose

7 bottle_review_Mouth

8 bottle_review_Finish

9 first score

10 all other score

11 combine all score

12 page_published_date

13 page_class

14 page_title

15 combine all one_page_review

16 output

Back to top