Python 使用Beauty Soup选择HTML页面值

Python 使用Beauty Soup选择HTML页面值,python,python-3.x,beautifulsoup,Python,Python 3.x,Beautifulsoup,我花了几个小时试图弄明白这一点,结果弄得我头晕目眩。我尝试的每一种方法都没有给出正确的值 import requests from bs4 import BeautifulSoup r = requests.get('https://www.off---white.com/en/GB/products/omia065s188000160100') soup = BeautifulSoup(r.content, 'html.parser') 我想从网页()中提取以下值 如何使用Beautifu

我花了几个小时试图弄明白这一点,结果弄得我头晕目眩。我尝试的每一种方法都没有给出正确的值

import requests
from bs4 import BeautifulSoup

r = requests.get('https://www.off---white.com/en/GB/products/omia065s188000160100')
soup = BeautifulSoup(r.content, 'html.parser')
我想从网页()中提取以下值


如何使用Beautiful Soup提取这3个值

这个链接指向一个“我不是机器人”页面。啊,那是因为你的IP被他们的服务标记了。展示你的每种方法你可以选择你自己的答案。甚至还有奖章奖励这种行为
import requests
from bs4 import BeautifulSoup

# Get prod name
r = requests.get('https://www.off---white.com/en/GB/products/omia065s188000160100')
soup = BeautifulSoup(r.text, 'html.parser')
spans = soup.find_all('span', {'class' : 'prod-title'})
data = [span.get_text() for span in spans]
prod_name = ''.join(data)

# Find prod price
spans = soup.find_all('div', {'class' : 'price'})
data = [span.get_text() for span in spans]
prod_price = ''.join(data)

# Find prod img
spans = soup.find_all('img', {'id' : 'image-0'})

for meta in spans:
    prod_img = meta.attrs['src']

print(prod_name)
print(prod_price)
print(prod_img)
import requests
from bs4 import BeautifulSoup

# Get prod name
r = requests.get('https://www.off---white.com/en/GB/products/omia065s188000160100')
soup = BeautifulSoup(r.text, 'html.parser')
spans = soup.find_all('span', {'class' : 'prod-title'})
data = [span.get_text() for span in spans]
prod_name = ''.join(data)

# Find prod price
spans = soup.find_all('div', {'class' : 'price'})
data = [span.get_text() for span in spans]
prod_price = ''.join(data)

# Find prod img
spans = soup.find_all('img', {'id' : 'image-0'})

for meta in spans:
    prod_img = meta.attrs['src']

print(prod_name)
print(prod_price)
print(prod_img)