-
Notifications
You must be signed in to change notification settings - Fork 0
/
anime_price_scraper.py
executable file
·32 lines (26 loc) · 1.01 KB
/
anime_price_scraper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python3
###############################################################################
# Author: Sean Hendrickson
# File: anime_collection_scraper.py
# Desc: This file is used to find the name and price for bluray/dvd box sets
# from rightstufanime.com
#
# All links will be passed through a text file called
# anime_series_hyperlinks and printed to standard output
###############################################################################
import requests
from bs4 import BeautifulSoup
# read data from a text file
with open('hyperlinks.txt', 'r') as f:
URL_list = f.readlines()
# open each URL
for URL in URL_list:
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
# find page elements
title_element = soup.find(class_="product-details-full-content-header-title")
price_element = soup.find(class_="product-views-price-lead")
# Display results
print(title_element.text.strip())
print(price_element.text.strip())
print()