python - 爬虫如何获取onclick的链接
大家讲道理
大家讲道理 2017-04-18 10:23:14
0
3
1624
<a onclick="xxx(1)">xxxx</a>

类似如上这种需要点击一下才会打开一个网页的,这种链接该如何获取呢?
除了手工分析参数自己构造请求, selenium 定位模拟点击,还有什么方法么?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
Ty80

If the js is obfuscated or encrypted and the link cannot be obtained directly from the code, then only simulated clicks can be done.

洪涛
from bs4 import BeautifulSoup as bs

for a_tag in  bs(html_body,'html.parser').find_all('a'):
    print(a_tag['onclick'])
阿神

Regular expression extraction

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!