import requests
from bs4 import BeautifulSoup
def get_data(url, headers):
'''
两个参数
:param url:统一资源定位符,请求网址
:param headers:请求头
:return data:list类型的所有古诗内容
'''
# ***************** Begin ******************** #
response = requests.get(url, headers=headers)
response.encoding = "utf-8"
html = response.text
soup = BeautifulSoup(html, 'lxml')
data = soup.find('div', {'class': 'left'}).ul.find_all('li')
data = [i.p.text for i in data]
# ****************** end ********************* #
return data