效果图
# -*- 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)