【发布时间】:2019-08-04 00:35:17
【问题描述】:
我正在尝试从 <a href=> 抓取 url 地址
但是这个网站的<href> 是#none。
我怎样才能抓取这个 url 地址?
我已经想通了很多,但我找不到提示。
喜欢这个
<a href="#none" onclick="goDetail(519975);">
title
<a>
from urllib.request import urlopen
from bs4 import BeautifulSoup
import ssl
import re
ssl._create_default_https_context = ssl._create_unverified_context
html = urlopen('https://www.daegu.ac.kr/article/DG159/list')
bs = BeautifulSoup(html, 'html.parser')
nameList = bs.findAll('td', {'class': 'list_left'})
for name in nameList:
print(name.get_text())
print(name.get_url)
print('\n----------------------------------------------')
【问题讨论】:
-
简短的回答是“你不能”。您可以使用selenium 自动运行将运行由链接触发的 javascript 的浏览器
-
您可能必须使用无头浏览器!
-
所以我需要使用“硒”对吗?我会弄清楚的!谢谢你们。
标签: python html web-scraping beautifulsoup web-crawler