API文档:
API_Key:
通过个人中心和相关的认证,就可以免费获取到Key。
可以点击申请新数据,跟新建应用是一样的。
我们申请到免费的Key为:a651cda7b49325ff4e6b2142aa467b54
代码调用:
这里跟我上一个博客代码是一样的,只需要注意根据参数要求修改url的书写:
我们只需要按照参数请求说明,在问号后面加上各个参数的赋值情况,组建成一个新的url。
如:
url = fhttp://v.juhe.cn/toutiao/index?type=top&key={API_KEY}&page=1
代码:
import requests
API_KEY = "a651cda7b49325ff4e6b2142aa467b54"
url = f"http://v.juhe.cn/toutiao/index?type=top&key={API_KEY}&page=1"
response = requests.get(url)
data = response.json()
返回为:
{'reason': 'success!', 'result': {'stat': '1', 'data': [{'uniquekey': 'd5b3b25ac7c0f2c44ade3935612380a0', 'title': '中国工程院院士、南昌大学食品科学与技术国家重点实验室主任谢明勇到蜡笔小新集团参观交流', 'date': '2023-04-18 23:14:00', 'category': '头条', 'author_name': '中国质量新闻网', 'url': 'https://mini.eastday.com/mobile/230418231459656538036.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418231459_5a956a2ac4f2dcd52c2f3e482dcefb7a_1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '40defe806938a35e20588f68cfd171f1', 'title': '四川46岁民警蒋久华勇斗持刀歹徒,不幸牺牲', 'date': '2023-04-18 23:12:00', 'category': '头条', 'author_name': '微信公号“青神县公安局”', 'url': 'https://mini.eastday.com/mobile/230418231212064832434.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418231212_c1118a2cc67ace0d74503d03f2401a7b_1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '130f1fdf50cd36e17097d4693201b1d6', 'title': '海峡两岸纺织服装博览会暨科技成果交易会在石狮开馆', 'date': '2023-04-18 22:55:00', 'category': '头条', 'author_name': '人民日报客户端福建频道,供稿:人民资讯', 'url': 'https://mini.eastday.com/mobile/230418225500358599517.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418225500_999ac0d2155f96339e2c521cac5defd8_1_mwpm_03201609.jpeg', 'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418225500_999ac0d2155f96339e2c521cac5defd8_2_mwpm_03201609.jpeg', 'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418225500_999ac0d2155f96339e2c521cac5defd8_3_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': 'a7c9ec84d884fc9d52e5744f4a0e94cb', 'title': '安徽宿州埇桥区通报演出人员坠亡事件:系违规演出,已启动问责', 'date': '2023-04-18 22:40:00', 'category': '头条', 'author_name': '@宿州埇桥发布', 'url': 'https://mini.eastday.com/mobile/230418224003134615159.html', 'thumbnail_pic_s': '', 'is_content': '1'}, {'uniquekey': 'c47b3572dec31588399e3b53e3fd4469', 'title': '北京市离境退税商店已超千家', 'date': '2023-04-18 22:16:00', 'category': '头条', 'author_name': '每日看点快看', 'url': 'https://mini.eastday.com/mobile/230418221630499313306.html', 'thumbnail_pic_s': '', 'is_content': '1'}, {'uniquekey': '55240bf6ee0d96452b111c76da3369f4', 'title': '穷尽毕生精力 助力气象发展——专访2022年度风云成就奖获得者郭肖容张德二', 'date': '2023-04-18 20:28:00', 'category': '头条', 'author_name': '每日看点快看', 'url': 'https://mini.eastday.com/mobile/230418202814288863881.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418202814_fd2b14728dd049093ab33c370af3f17e_1_mwpm_03201609.jpeg', 'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418202814_fd2b14728dd049093ab33c370af3f17e_2_mwpm_03201609.jpeg', 'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418202814_fd2b14728dd049093ab33c370af3f17e_3_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': 'c7c8b4d12b2aff934aadd2a543afe7f3', 'title': '“童话大王”郑渊洁宣布停止商标维权,同时不再发表任何文字作品', 'date': '2023-04-18 20:26:00', 'category': '头条', 'author_name': '每日看点快看', 'url': 'https://mini.eastday.com/mobile/230418202634777661086.html', 'thumbnail_pic_s': '', 'is_content': '1'}, {'uniquekey': '56945c36a6eff21af670f2e85eeb5528', 'title': '致敬!这位99岁院士,为何被称为“草人”?', 'date': '2023-04-18 20:18:00', 'category': '头条', 'author_name': '人民日报客户端,供稿:人民资讯', 'url': 'https://mini.eastday.com/mobile/230418201811602671435.html', 'thumbnail_pic_s': '', 'is_content': '1'}, {'uniquekey': 'eb2f03c9ca8eb729a528aeb280eb61d5', 'title': '点亮心智障碍者家庭“心中明灯” 连云港赣榆有个“秦爸爸”', 'date': '2023-04-18 20:10:00', 'category': '头条', 'author_name': '人民网-江苏频道,供稿:人民资讯', 'url': 'https://mini.eastday.com/mobile/230418201027765510556.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418201027_6dd1cb55a9fea86e889b9b1a9720fe35_1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': 'cff0d42d38e67d7472eb5438e9adf55c', 'title': '杭州立法保障外卖员劳动权益', 'date': '2023-04-18 20:06:00', 'category': '头条', 'author_name': '每日看点快看', 'url': 'https://mini.eastday.com/mobile/230418200628911332617.html', 'thumbnail_pic_s': '', 'is_content': '1'}, {'uniquekey': 'e056626af195868e02e51b11c35c5741', 'title': '描绘心中的“北京故事” 《我爱北京》作品集向全球青少年征集原创作品', 'date': '2023-04-18 19:58:00', 'category': '头条', 'author_name': '人民网-北京频道,供稿:人民资讯', 'url': 'https://mini.eastday.com/mobile/230418195817040941188.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195817_098dfa8581af43de6cd6e83023ef60fb_1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '6dd2694274dfc0bf3d25de398981dc93', 'title': '凝心聚力,为爱护航,百度公益传递温暖,让爱延续!', 'date': '2023-04-18 19:54:00', 'category': '头条', 'author_name': '江苏商报', 'url': 'https://mini.eastday.com/mobile/230418195417115968926.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195417_b8bfe4cbf089557f052f63c55a72a079_1_mwpm_03201609.jpeg', 'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195417_b8bfe4cbf089557f052f63c55a72a079_6_mwpm_03201609.jpeg', 'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195417_b8bfe4cbf089557f052f63c55a72a079_8_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '58715217dcdd081a9106b6ec47129d6b', 'title': '湖南高院与中国银保监会湖南监管局联手,破解“送达难”', 'date': '2023-04-18 18:33:00', 'category': '头条', 'author_name': '人民日报客户端湖南频道,供稿:人民资讯', 'url': 'https://mini.eastday.com/mobile/230418183320562526827.html', 'thumbnail_pic_s': '', 'is_content': '1'}, {'uniquekey': 'c0203369177ad83486c9276158ad34d4', 'title': '新疆巴音郭楞蒙古自治州320万亩棉花播种工作有序展开', 'date': '2023-04-18 18:29:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418182957208459195.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x280_643e711d4ccd9_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '57f9658d524b6b5d0752ebddbee5434e', 'title': '【广东】无证经营药品和销售药品不开具销售凭证 高州市里麻良辉药店被罚款1.63万元', 'date': '2023-04-18 17:38:00', 'category': '头条', 'author_name': '中国质量新闻网', 'url': 'https://mini.eastday.com/mobile/230418173845898877222.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173845_875a7235ec59f8c6a45b44ec95c3c55e_1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '14ae84fb7296265952b31fc3cb118c0a', 'title': '生死瞬间 克拉玛依两名公交车司机飞奔救援落水女子', 'date': '2023-04-18 17:37:00', 'category': '头条', 'author_name': '每日看点快看', 'url': 'https://mini.eastday.com/mobile/230418173715102919800.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173715_1f5c20058e600db72bd6fbe80aeb05a6_1_mwpm_03201609.jpeg', 'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173715_1f5c20058e600db72bd6fbe80aeb05a6_2_mwpm_03201609.jpeg', 'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173715_1f5c20058e600db72bd6fbe80aeb05a6_3_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '3597c13d91348ef908ed83a666278e95', 'title': '大风、沙尘、降雪……新疆多条国省道部分路段实施交通管制', 'date': '2023-04-18 17:21:00', 'category': '头条', 'author_name': '每日看点快看', 'url': 'https://mini.eastday.com/mobile/230418172155717214004.html', 'thumbnail_pic_s': '', 'is_content': '1'}, {'uniquekey': '0db7fa6c68bceb7af3b395d78cd1180b', 'title': '【广东湛江】廉江市城北怡家装饰设计店未按规定公示年报被处罚', 'date': '2023-04-18 17:07:00', 'category': '头条', 'author_name': '中国质量新闻网', 'url': 'https://mini.eastday.com/mobile/230418170757302138339.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418170757_dc1b4ecf1950c2a168ed5a8c60c622c7_1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': 'c1cde5e94efec196f2cfb4383d28cf50', 'title': '【广东】吴川市海滨浩煜五金交电商店侵犯注册商标专用权的电缆被罚款1万元', 'date': '2023-04-18 17:06:00', 'category': '头条', 'author_name': '中国质量新闻网', 'url': 'https://mini.eastday.com/mobile/230418170603367590951.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418170603_87a65992e0e5456ca1d0ad2a85fe6a02_1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': 'ea574406fd75031d0569520b10e1a1ce', 'title': '男子突然心跳、呼吸骤停,“蛛丝马迹”找出病因', 'date': '2023-04-18 17:05:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418170535280133460.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/554x415_643e5d5ebe039_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '384cff8e363b91506d00eb1ffa8068f7', 'title': '安阳“十大网红打卡地”征集评选活动火热进行中', 'date': '2023-04-18 17:04:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418170408296269008.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x480_643e5d07a5b78_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': 'd76c35cc9a9626ce7e99dc48fc3bca7c', 'title': '员工称在家养病却飞往海南遭解雇,法院:合法', 'date': '2023-04-18 16:50:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418165002188246037.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x304_643e3db075819_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '2cdcf814acec46e0cea270dcb370dd68', 'title': '湖北一船厂喷涂油漆引发爆炸致7死5伤', 'date': '2023-04-18 16:42:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418164201831809283.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/632x402_643e3bbf6e98f_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '99df0f5d81c5aa1a824d8fdb77c50632', 'title': '上海交警查获酒驾1746起营运司机酒驾占1.4%', 'date': '2023-04-18 16:41:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418164101592668634.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x480_643e3b85857a7_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '14442189874b67737ef6e9a9ca8e1345', 'title': '被叫“龙小”但又不属龙,耄耋老人打起了嘀咕', 'date': '2023-04-18 16:33:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418163332097821893.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x480_643e55db988c1_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '66e12d56ac7080a34abbb1c7aab60e84', 'title': '新疆伊犁那拉提“空中草原”顶冰花绽放', 'date': '2023-04-18 16:33:00', 'category': '头条', 'author_name': '科普社会', 'url': 'https://mini.eastday.com/mobile/230418163301781330152.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x419_643e39b7e2f29_mwpm_03201609.jpeg', 'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x419_643e39b886c64_mwpm_03201609.jpeg', 'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x419_643e39b918495_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '2cf58c3ee61ffdbfc5e8b7c2b36ea9c6', 'title': '阔别47年再重逢,这个服务站助力退役老兵圆梦', 'date': '2023-04-18 16:14:00', 'category': '头条', 'author_name': '锋行天下', 'url': 'https://mini.eastday.com/mobile/230418161427115309312.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x446_643e5161757ec_mwpm_03201609.jpeg', 'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x438_643e516206546_mwpm_03201609.jpeg', 'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x1176_643e516296c0a_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '687c06606aa9c494a313af8af921cc5a', 'title': '学校湖里捞起6200斤鱼,浙江一高校:全校师生免费吃!', 'date': '2023-04-18 14:56:00', 'category': '头条', 'author_name': '国际时事讲解', 'url': 'https://mini.eastday.com/mobile/230418145633274751258.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x400_643e3f1f08d9f_mwpm_03201609.jpeg', 'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x395_643e3f1f90944_mwpm_03201609.jpeg', 'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x398_643e3f201bcf4_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '25cb3f42523cf30db7bcccde7e4301b8', 'title': '女子街头骑车时,突遇一老人从路边踉踉跄跄冲出来……', 'date': '2023-04-18 14:53:00', 'category': '头条', 'author_name': '国际时事讲解', 'url': 'https://mini.eastday.com/mobile/230418145354904948229.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/540x688_643e3e8237998_mwpm_03201609.jpeg', 'is_content': '1'}, {'uniquekey': '8d322f299df03095ffd63c32e1a70b71', 'title': '利剑斩毒!广西警方缴获毒品约1.05公斤', 'date': '2023-04-18 14:51:00', 'category': '头条', 'author_name': '国际时事讲解', 'url': 'https://mini.eastday.com/mobile/230418145150186597759.html', 'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x384_643e3e059acc2_mwpm_03201609.jpeg', 'is_content': '1'}], 'page': '1', 'pageSize': '30'}, 'error_code': 0}
咳,非常多。。。–!
然后用JSON在线工具进行解析,这样层次结构就会非常清晰:
{
'reason': 'success!',
'result': {
'stat': '1',
'data': [{
'uniquekey': 'd5b3b25ac7c0f2c44ade3935612380a0',
'title': '中国工程院院士、南昌大学食品科学与技术国家重点实验室主任谢明勇到蜡笔小新集团参观交流',
'date': '2023-04-18 23:14:00',
'category': '头条',
'author_name': '中国质量新闻网',
'url': 'https://mini.eastday.com/mobile/230418231459656538036.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418231459_5a956a2ac4f2dcd52c2f3e482dcefb7a_1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '40defe806938a35e20588f68cfd171f1',
'title': '四川46岁民警蒋久华勇斗持刀歹徒,不幸牺牲',
'date': '2023-04-18 23:12:00',
'category'
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418231212_c1118a2cc67ace0d74503d03f2401a7b_1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '130f1fdf50cd36e17097d4693201b1d6',
'title': '海峡两岸纺织服装博览会暨科技成果交易会在石狮开馆',
'date': '2023-04-18 22:55:00',
'category': '头条',
'author_name': '人民日报客户端福建频道,供稿:人民资讯',
'url': 'https://mini.eastday.com/mobile/230418225500358599517.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418225500_999ac0d2155f96339e2c521cac5defd8_1_mwpm_03201609.jpeg',
'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418225500_999ac0d2155f96339e2c521cac5defd8_2_mwpm_03201609.jpeg',
'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418225500_999ac0d2155f96339e2c521cac5defd8_3_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': 'a7c9ec84d884fc9d52e5744f4a0e94cb',
'title': '安徽宿州埇桥区通报演出人员坠亡事件:系违规演出,已启动问责',
'date': '2023-04-18 22:40:00',
'category': '头条',
'author_name': '@宿州埇桥发布',
'url': 'https://mini.eastday.com/mobile/230418224003134615159.html',
'thumbnail_pic_s': '',
'is_content': '1'
}, {
'uniquekey': 'c47b3572dec31588399e3b53e3fd4469',
'title': '北京市离境退税商店已超千家',
'date': '2023-04-18 22:16:00',
'category': '头条',
'author_name': '每日看点快看',
'url': 'https://mini.eastday.com/mobile/230418221630499313306.html',
'thumbnail_pic_s': '',
'is_content': '1'
}, {
'uniquekey': '55240bf6ee0d96452b111c76da3369f4',
'title': '穷尽毕生精力 助力气象发展——专访2022年度风云成就奖获得者郭肖容张德二',
'date': '2023-04-18 20:28:00',
'category': '头条',
'author_name': '每日看点快看',
'url': 'https://mini.eastday.com/mobile/230418202814288863881.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418202814_fd2b14728dd049093ab33c370af3f17e_1_mwpm_03201609.jpeg',
'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418202814_fd2b14728dd049093ab33c370af3f17e_2_mwpm_03201609.jpeg',
'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418202814_fd2b14728dd049093ab33c370af3f17e_3_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': 'c7c8b4d12b2aff934aadd2a543afe7f3',
'title': '“童话大王”郑渊洁宣布停止商标维权,同时不再发表任何文字作品',
'date': '2023-04-18 20:26:00',
'category': '头条',
'author_name': '每日看点快看',
'url': 'https://mini.eastday.com/mobile/230418202634777661086.html',
'thumbnail_pic_s': '',
'is_content': '1'
}, {
'uniquekey': '56945c36a6eff21af670f2e85eeb5528',
'title': '致敬!这位99岁院士,为何被称为“草人”?',
'date': '2023-04-18 20:18:00',
'category': '头条',
'author_name': '人民日报客户端,供稿:人民资讯',
'url': 'https://mini.eastday.com/mobile/230418201811602671435.html',
'thumbnail_pic_s': '',
'is_content': '1'
}, {
'uniquekey': 'eb2f03c9ca8eb729a528aeb280eb61d5',
'title': '点亮心智障碍者家庭“心中明灯” 连云港赣榆有个“秦爸爸”',
'date': '2023-04-18 20:10:00',
'category': '头条',
'author_name': '人民网-江苏频道,供稿:人民资讯',
'url': 'https://mini.eastday.com/mobile/230418201027765510556.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418201027_6dd1cb55a9fea86e889b9b1a9720fe35_1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': 'cff0d42d38e67d7472eb5438e9adf55c',
'title': '杭州立法保障外卖员劳动权益',
'date': '2023-04-18 20:06:00',
'category': '头条',
'author_name': '每日看点快看',
'url': 'https://mini.eastday.com/mobile/230418200628911332617.html',
'thumbnail_pic_s': '',
'is_content': '1'
}, {
'uniquekey': 'e056626af195868e02e51b11c35c5741',
'title': '描绘心中的“北京故事” 《我爱北京》作品集向全球青少年征集原创作品',
'date': '2023-04-18 19:58:00',
'category': '头条',
'author_name': '人民网-北京频道,供稿:人民资讯',
'url': 'https://mini.eastday.com/mobile/230418195817040941188.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195817_098dfa8581af43de6cd6e83023ef60fb_1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '6dd2694274dfc0bf3d25de398981dc93',
'title': '凝心聚力,为爱护航,百度公益传递温暖,让爱延续!',
'date': '2023-04-18 19:54:00',
'category': '头条',
'author_name': '江苏商报',
'url': 'https://mini.eastday.com/mobile/230418195417115968926.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195417_b8bfe4cbf089557f052f63c55a72a079_1_mwpm_03201609.jpeg',
'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195417_b8bfe4cbf089557f052f63c55a72a079_6_mwpm_03201609.jpeg',
'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418195417_b8bfe4cbf089557f052f63c55a72a079_8_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '58715217dcdd081a9106b6ec47129d6b',
'title': '湖南高院与中国银保监会湖南监管局联手,破解“送达难”',
'date': '2023-04-18 18:33:00',
'category': '头条',
'author_name': '人民日报客户端湖南频道,供稿:人民资讯',
'url': 'https://mini.eastday.com/mobile/230418183320562526827.html',
'thumbnail_pic_s': '',
'is_content': '1'
}, {
'uniquekey': 'c0203369177ad83486c9276158ad34d4',
'title': '新疆巴音郭楞蒙古自治州320万亩棉花播种工作有序展开',
'date': '2023-04-18 18:29:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418182957208459195.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x280_643e711d4ccd9_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '57f9658d524b6b5d0752ebddbee5434e',
'title': '【广东】无证经营药品和销售药品不开具销售凭证 高州市里麻良辉药店被罚款1.63万元',
'date': '2023-04-18 17:38:00',
'category': '头条',
'author_name': '中国质量新闻网',
'url': 'https://mini.eastday.com/mobile/230418173845898877222.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173845_875a7235ec59f8c6a45b44ec95c3c55e_1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '14ae84fb7296265952b31fc3cb118c0a',
'title': '生死瞬间 克拉玛依两名公交车司机飞奔救援落水女子',
'date': '2023-04-18 17:37:00',
'category': '头条',
'author_name': '每日看点快看',
'url': 'https://mini.eastday.com/mobile/230418173715102919800.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173715_1f5c20058e600db72bd6fbe80aeb05a6_1_mwpm_03201609.jpeg',
'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173715_1f5c20058e600db72bd6fbe80aeb05a6_2_mwpm_03201609.jpeg',
'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418173715_1f5c20058e600db72bd6fbe80aeb05a6_3_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '3597c13d91348ef908ed83a666278e95',
'title': '大风、沙尘、降雪……新疆多条国省道部分路段实施交通管制',
'date': '2023-04-18 17:21:00',
'category': '头条',
'author_name': '每日看点快看',
'url': 'https://mini.eastday.com/mobile/230418172155717214004.html',
'thumbnail_pic_s': '',
'is_content': '1'
}, {
'uniquekey': '0db7fa6c68bceb7af3b395d78cd1180b',
'title': '【广东湛江】廉江市城北怡家装饰设计店未按规定公示年报被处罚',
'date': '2023-04-18 17:07:00',
'category': '头条',
'author_name': '中国质量新闻网',
'url': 'https://mini.eastday.com/mobile/230418170757302138339.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418170757_dc1b4ecf1950c2a168ed5a8c60c622c7_1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': 'c1cde5e94efec196f2cfb4383d28cf50',
'title': '【广东】吴川市海滨浩煜五金交电商店侵犯注册商标专用权的电缆被罚款1万元',
'date': '2023-04-18 17:06:00',
'category': '头条',
'author_name': '中国质量新闻网',
'url': 'https://mini.eastday.com/mobile/230418170603367590951.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/news/20230418/20230418170603_87a65992e0e5456ca1d0ad2a85fe6a02_1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': 'ea574406fd75031d0569520b10e1a1ce',
'title': '男子突然心跳、呼吸骤停,“蛛丝马迹”找出病因',
'date': '2023-04-18 17:05:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418170535280133460.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/554x415_643e5d5ebe039_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '384cff8e363b91506d00eb1ffa8068f7',
'title': '安阳“十大网红打卡地”征集评选活动火热进行中',
'date': '2023-04-18 17:04:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418170408296269008.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x480_643e5d07a5b78_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': 'd76c35cc9a9626ce7e99dc48fc3bca7c',
'title': '员工称在家养病却飞往海南遭解雇,法院:合法',
'date': '2023-04-18 16:50:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418165002188246037.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x304_643e3db075819_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '2cdcf814acec46e0cea270dcb370dd68',
'title': '湖北一船厂喷涂油漆引发爆炸致7死5伤',
'date': '2023-04-18 16:42:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418164201831809283.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/632x402_643e3bbf6e98f_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '99df0f5d81c5aa1a824d8fdb77c50632',
'title': '上海交警查获酒驾1746起营运司机酒驾占1.4%',
'date': '2023-04-18 16:41:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418164101592668634.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x480_643e3b85857a7_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '14442189874b67737ef6e9a9ca8e1345',
'title': '被叫“龙小”但又不属龙,耄耋老人打起了嘀咕',
'date': '2023-04-18 16:33:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418163332097821893.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x480_643e55db988c1_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '66e12d56ac7080a34abbb1c7aab60e84',
'title': '新疆伊犁那拉提“空中草原”顶冰花绽放',
'date': '2023-04-18 16:33:00',
'category': '头条',
'author_name': '科普社会',
'url': 'https://mini.eastday.com/mobile/230418163301781330152.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x419_643e39b7e2f29_mwpm_03201609.jpeg',
'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x419_643e39b886c64_mwpm_03201609.jpeg',
'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x419_643e39b918495_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '2cf58c3ee61ffdbfc5e8b7c2b36ea9c6',
'title': '阔别47年再重逢,这个服务站助力退役老兵圆梦',
'date': '2023-04-18 16:14:00',
'category': '头条',
'author_name': '锋行天下',
'url': 'https://mini.eastday.com/mobile/230418161427115309312.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x446_643e5161757ec_mwpm_03201609.jpeg',
'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x438_643e516206546_mwpm_03201609.jpeg',
'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/640x1176_643e516296c0a_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '687c06606aa9c494a313af8af921cc5a',
'title': '学校湖里捞起6200斤鱼,浙江一高校:全校师生免费吃!',
'date': '2023-04-18 14:56:00',
'category': '头条',
'author_name': '国际时事讲解',
'url': 'https://mini.eastday.com/mobile/230418145633274751258.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x400_643e3f1f08d9f_mwpm_03201609.jpeg',
'thumbnail_pic_s02': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x395_643e3f1f90944_mwpm_03201609.jpeg',
'thumbnail_pic_s03': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x398_643e3f201bcf4_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '25cb3f42523cf30db7bcccde7e4301b8',
'title': '女子街头骑车时,突遇一老人从路边踉踉跄跄冲出来……',
'date': '2023-04-18 14:53:00',
'category': '头条',
'author_name': '国际时事讲解',
'url': 'https://mini.eastday.com/mobile/230418145354904948229.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/540x688_643e3e8237998_mwpm_03201609.jpeg',
'is_content': '1'
}, {
'uniquekey': '8d322f299df03095ffd63c32e1a70b71',
'title': '利剑斩毒!广西警方缴获毒品约1.05公斤',
'date': '2023-04-18 14:51:00',
'category': '头条',
'author_name': '国际时事讲解',
'url': 'https://mini.eastday.com/mobile/230418145150186597759.html',
'thumbnail_pic_s': 'https://dfzximg02.dftoutiao.com/minimodify/20230418/600x384_643e3e059acc2_mwpm_03201609.jpeg',
'is_content': '1'
}],
'page': '1',
'pageSize': '30'
},
'error_code': 0
}
用键值对查询,获取我们想要的信息:
s_title = data["result"]["data"][0]["title"]
s_date = data["result"]["data"][0]["date"]
s_category = data["result"]["data"][0]["category"]
print(f"标题: {s_title}")
print(f"日期: {s_date}")
print(f"种类: {s_category}")
返回:
标题: 八旬老人迷路 长沟河镇村干部接力送回
日期: 2023-04-19 09:59:00
种类: 头条
完整代码:
import requests
API_KEY = "a651cda7b49325ff4e6b2142aa467b54"
url = f"http://v.juhe.cn/toutiao/index?type=top&key={API_KEY}&page=1"
response = requests.get(url)
data = response.json()
#print(data)
s_title = data["result"]["data"][0]["title"]
s_date = data["result"]["data"][0]["date"]
s_category = data["result"]["data"][0]["category"]
print(f"标题: {s_title}")
print(f"日期: {s_date}")
print(f"种类: {s_category}")
欢迎使用!!!