【发布时间】:2017-09-20 12:16:26
【问题描述】:
嗨,我是 python 和网络抓取的新手,以下是我从网站获取 URL 的脚本,但我被困在两者之间,如果我检查网站,我无法从类标签中获取 URL,我可以看到 URL,但是在我的脚本中它显示为 javascript This is the link 任何帮助,请 提前致谢
from bs4 import BeautifulSoup
import urllib.request
import pandas as pd
url = "https://www.northcoastelectric.com/Products"
html = urllib.request.urlopen(url).read()
soup = BeautifulSoup(html)
something = soup.find(class_="clearAfter")
print(chips)
for i in something:
new_url = i.a["href"]
print(new_url)`
【问题讨论】:
-
具体是什么网址?你能提供一个你需要的样本吗
-
我需要网站中存在的产品 URL,就像有产品自动化和电机控制一样我需要该页面中所有产品的 URL
标签: python python-3.x web-scraping beautifulsoup web-crawler