时间:2021-07-01 10:21:17 帮助过:109人阅读
如图所示想得到 820,但是动态产生的。该新闻的url为 陕西眉县发红头文件:官员卖水泥买房纳入考核
这是微信公众平台获取聊天信息的action,fromfakeid就是聊天对方的id。import selenium
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox() # Get local session of firefox
browser.get("http://news.sina.com.cn/c/2013-07-11/175827642839.shtml ") # Load page
time.sleep(5) # Let the page load
try:
element = browser.find_element_by_xpath("//span[contains(@class,'f_red')]") # get element on page
print element.text # get element text
except NoSuchElementException:
assert 0, "can't find f_red"
browser.close()
>>> from selenium import webdriver
>>> c = webdriver.Chrome()
>>> c.get('http://news.sina.com.cn/c/2013-07-11/175827642839.shtml')
>>> comment = c.find_element_by_id('media_comment')
>>> count = comment.find_element_by_class_name('f_red')
>>> count.text
u'823'
我曾今使用python类库webkitgtk来解析网页,抽取html结构,获取数据,不过webkitgtk安装和使用过程略蛋疼,而且需要安装特定的版本,才可以操作获取数据。
您好,我看了您的硕士毕业论文,我也对这个论文推荐这个主题很感兴趣,但是我没能看懂您在LDA基础上改进的TV-IDF这个算法,利用4-2公式算不出您在4-3表中的TV-IPF的值,您能解释或者把具体的计算过程给我看一下吗?谢谢
使用 ghost.py 模块,模拟浏览器打开网页,获取的网页就是动态生成的。