request_law.py 文件源码

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

项目:dust_repos 作者: taozhijiang 项目源码 文件源码
def request_body(url):
    ret = ""
    browser = webdriver.PhantomJS()
    response = browser.get(url)
    content = browser.page_source
    soup = BeautifulSoup(content, 'lxml')
    bodys = soup.find('div', attrs={"class":"fd_article_ws "})
    if not bodys:
        print("Error1:" + url)
        return "??????"

    body = bodys.findAll('div')
    if not body:
        body = bodys.findAll('p')
        if not body:
            print("Error2:" + url)
            sys.exit()

    for item in body:
        if item and item.text:
            ret += item.text.strip() + "\n"

    return ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号