码迷,mamicode.com
首页 > 编程语言 > 详细

Python 爬取网页中JavaScript动态添加的内容(二)

时间:2018-09-28 16:38:31      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:爬取网页   web应用   int   table   targe   exe   工具   .net   添加   

使用 selenium + phantomjs 实现

1、准备环境

selenium(一个用于web应用程测试的工具)安装:pip install selenium
phantomjs(是一种无界面的浏览器,用于完成网页的渲染)下载:http://phantomjs.org/download.html

2、使用

from selenium import webdriver

url = http://jandan.net/ooxx
driver = webdriver.PhantomJS(
    executable_path=D:/Software/phantomjs-2.1.1-windows/bin/phantomjs.exe)  # phantomjs.exe所在的目录
driver.get(url)
print(driver.page_source)

 

Python 爬取网页中JavaScript动态添加的内容(二)

标签:爬取网页   web应用   int   table   targe   exe   工具   .net   添加   

原文地址:https://www.cnblogs.com/Jimc/p/9718794.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!