1
매우 정기적 인 구매를해야하고 직접 구입하기가 번거롭기 때문에 항목을 장바구니에 추가하고 나 구입할 봇을 작성하려고합니다.체크 아웃 제품에 아름다운 스프 저장 세션
from bs4 import BeautifulSoup
import requests
import numpy as np
page = requests.get("http://www.onlinestore.com/shop")
soup = BeautifulSoup(page.content, 'html.parser')
try:
for i in soup.find_all('a'):
if "shop" in i['href']:
shop_page = requests.get("http://www.onlinestore.com" + i['href'])
item_page = BeautifulSoup(shop_page.content, 'html.parser')
for h in item_page.find_all('form', class_="add"):
print(h['action'])
try:
shop_page = requests.get("http://www.online.com" + h['action'])
except:
print("None left")
for h in item_page.find_all('h1', class_="protect"):
print(h.getText())
except:
print("either ended or error occured")
checkout_page = requests.get("http://www.onlinestore.com/checkout")
checkout = BeautifulSoup(checkout_page.content, 'html.parser')
for j in checkout.find_all('strong', id_="total"):
print(j)
항목이 넘겨지지 않기 때문에 제품을 확인하는 데 약간의 문제가있었습니다. 장바구니에 추가 한 항목을 추적 할 수 있도록 쿠키를 구현할 수있는 방법이 있습니까?
감사