代码拉取完成,页面将自动刷新
import http.client
import urllib
import json
# 云音乐热评
def getReP():
conn = http.client.HTTPSConnection('api.tianapi.com') # 接口域名
params = urllib.parse.urlencode({'key': ''})
headers = {'Content-type': 'application/x-www-form-urlencoded'}
conn.request('POST', '/hotreview/index', params, headers)
res = conn.getresponse()
data = res.read()
# 获得json数据
data_json = data.decode('utf-8')
# json数据>>>python dict 数据
data_python = json.loads(data_json)
# print(data_python)
# python dict数据>>>需要的list数据
newList = data_python.get('newslist')
# list数据>>>dict数据
newList_dict = newList[0]
# 云音乐热评
content = newList_dict.get('content')
# 热评来源音乐
source = newList_dict.get('source')
return content, source
# 舔狗日记
def getTianGRJ():
conn = http.client.HTTPSConnection('api.tianapi.com') # 接口域名
params = urllib.parse.urlencode({'key': ''})
headers = {'Content-type': 'application/x-www-form-urlencoded'}
conn.request('POST', '/tiangou/index', params, headers)
res = conn.getresponse()
data = res.read()
# 获得json数据
data_json = data.decode('utf-8')
# json数据>>>python dict 数据
data_python = json.loads(data_json)
# print(data_python)
# python dict数据>>>需要的list数据
newList = data_python.get('newslist')
# list数据>>>dict数据
newList_dict = newList[0]
# 云音乐热评
content = newList_dict.get('content')
return content
# print(content)
# 英语一句话
def getEngEvDay():
conn = http.client.HTTPSConnection('api.tianapi.com') # 接口域名
params = urllib.parse.urlencode({'key': ''})
headers = {'Content-type': 'application/x-www-form-urlencoded'}
conn.request('POST', '/ensentence/index', params, headers)
res = conn.getresponse()
data = res.read()
# 获得json数据
data_json = data.decode('utf-8')
# json数据>>>python dict 数据
data_python = json.loads(data_json)
# print(data_python)
# python dict数据>>>需要的list数据
newList = data_python.get('newslist')
# list数据>>>dict数据
newList_dict = newList[0]
# 英语一句话
en = newList_dict.get('en')
zh = newList_dict.get('zh')
content = en + "\n" + zh
return content
# 每日晚安
def getEvDayWanAn():
conn = http.client.HTTPSConnection('api.tianapi.com') # 接口域名
params = urllib.parse.urlencode({'key': ''})
headers = {'Content-type': 'application/x-www-form-urlencoded'}
conn.request('POST', '/wanan/index', params, headers)
res = conn.getresponse()
data = res.read()
# 获得json数据
data_json = data.decode('utf-8')
# json数据>>>python dict 数据
data_python = json.loads(data_json)
# print(data_python)
# python dict数据>>>需要的list数据
newList = data_python.get('newslist')
# list数据>>>dict数据
newList_dict = newList[0]
# 每日晚安
content = newList_dict.get('content')
return content
# print(content)
# 每日早安
def getEvDayZaoAn():
conn = http.client.HTTPSConnection('api.tianapi.com') # 接口域名
params = urllib.parse.urlencode({'key': ''})
headers = {'Content-type': 'application/x-www-form-urlencoded'}
conn.request('POST', '/wanan/index', params, headers)
res = conn.getresponse()
data = res.read()
# 获得json数据
data_json = data.decode('utf-8')
# json数据>>>python dict 数据
data_python = json.loads(data_json)
# print(data_python)
# python dict数据>>>需要的list数据
newList = data_python.get('newslist')
# list数据>>>dict数据
newList_dict = newList[0]
# 每日早安
content = newList_dict.get('content')
return content
# print(content)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。