【发布时间】:2020-03-29 03:38:15
【问题描述】:
shoe = input('Shoe name: ')
URL = 'https://stockx.com/search?s='+shoe
page = requests.get(URL, headers= headers)
soup = BeautifulSoup(page.content, 'html.parser')
time.sleep(2) #this was to ensure the webpage was having enough time to load so that it wouldn't try to scrape a prematurely loaded website.
test = soup.find(class_ = 'BrowseSearchDescription__SearchConfirmation-sc-1mt8qyd-1 dcjzxm')
print(test) #returns none
print(URL) #prings the URL (which is the correct URL of the website I'm attempting to scrape)
我知道我可以使用 Selenium 轻松完成此操作,但是,它会加载 chrome 选项卡并导航到网页,因此效率非常低。我正在努力提高效率,而我最初的“原型”确实使用了 Selenium,但是它总是被检测为机器人,并且我的整个代码都被验证码阻止了。我是否做错了什么导致代码返回“无”,或者该特定网页是否不可抓取。如果需要,具体网址为https://stockx.com/search?s=yeezy
【问题讨论】:
-
如果不是安全问题,你能提供标题吗?
标签: python html python-requests