Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3. import re
  4. import threading
  5.  
  6.  
  7. fp = open("board_game_academy_lists.txt", "w", encoding="utf-8")
  8.  
  9. for page in range(1, 12):
  10.     url = "https://www.boardgameacademia.com/category?tskp=" + str(page)
  11.     r = requests.get(url)
  12.     soup = BeautifulSoup(r.content, "html.parser")
  13.  
  14.     for product in soup.find_all("div", class_="productItem"):
  15.         for title in product.find_all("div", class_="product_name"):
  16.             print(title.text)
  17.             fp.write(title.text + ';')
  18.            
  19.         for price in product.find_all("div", class_="product_price"):
  20.             fp.write(price.text + ';')
  21.            
  22.         for old_price in product.find_all("div", class_="product_price_old"):
  23.             fp.write(old_price.text)
  24.  
  25.         fp.write('\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement