DIY_JSParser.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Hanhan_NLP 作者: hanhanwu 项目源码 文件源码
def main():
    comment_urls = [
        "http://www.theglobeandmail.com/opinion/a-fascists-win-americas-moral-loss/article32753320/comments/"
                   ]

    for comment_url in comment_urls:
        driver = webdriver.Firefox()
        driver.get(comment_url)
        time.sleep(5)
        htmlSource = driver.page_source
        clk = driver.find_element_by_css_selector('div.c3qHyJD')
        clk.click()
        reaction_counts = driver.find_elements_by_class_name('c2oytXt')
        for rc in reaction_counts:
            print(rc.text)
        driver.close()   # close the browser
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号