爬虫入门之抓取糗事百科热门
作者:
NoValue | 来源:发表于
2017-05-06 23:39 被阅读53次
效果图

choushi_baike.png
# -*- coding:utf-8 -*-
# **********************************
# ** http://weibo.com/lixiaodaoaaa #
# ****** by:lixiaodaoaaa ***********
import requests
import json
from bs4 import BeautifulSoup, Tag
from datetime import datetime
def convertUrlToBeautifulSoup(url):
getStr = requests.get(url)
getStr.encoding = "utf-8"
return BeautifulSoup(getStr.text, "html.parser")
myCrapUlr = "http://www.qiushibaike.com/hot/"
mySoup = convertUrlToBeautifulSoup(myCrapUlr)
for content in mySoup.select(".content"):
print(content.text)
本文标题:爬虫入门之抓取糗事百科热门
本文链接:https://www.haomeiwen.com/subject/qegytxtx.html
网友评论