当前位置:网站首页>Get the data of the top 100 headlines today with Tianxing data
Get the data of the top 100 headlines today with Tianxing data
2022-07-04 10:45:00 【She was your flaw】
Get the top of today's headlines with Tianxing data 100 Data , Save to excel
from datetime import datetime
import openpyxl
import requests
workbook = openpyxl.Workbook()
sheet = workbook.active
sheet.append((' Time ', ' title ', ' link ', ' source '))
# Get the top of today's headlines 100 Data
for page in range(1, 6):
resp = requests.get(
url='http://api.tianapi.com/topnews/index',
params={
'key': ' The parameter value of the request parameter ',
'page': page,
'num': 20
}
)
# preservation json data
result = resp.json()
for news_dict in result['newslist']:
# Save data by tuples
ctime, title, url, source = news_dict['ctime'], news_dict['title'], news_dict['url'], news_dict['source']
# Add data to the worksheet
sheet.append((ctime, title, url, source))
# Get the present time
curr = datetime.now()
# Give your job a bad name
workbook.save(f' Today's headline data _{
curr.year}-{
curr.month:0>2d}-{
curr.day:0>2d}.xlsx')
边栏推荐
- Does any teacher know how to inherit richsourcefunction custom reading Mysql to do increment?
- Four characteristics and isolation levels of database transactions
- Network disk installation
- Reasons and solutions for the 8-hour difference in mongodb data date display
- On binary tree (C language)
- Press the button wizard to learn how to fight monsters - identify the map, run the map, enter the gang and identify NPC
- DNS hijacking
- Batch distribution of SSH keys and batch execution of ansible
- Talk about scalability
- Latex error: missing delimiter (. Inserted) {\xi \left( {p,{p_q}} \right)} \right|}}
猜你喜欢
BGP ---- border gateway routing protocol ----- basic experiment
What is an excellent architect in my heart?
VI text editor and user rights management, group management and time management
Static comprehensive experiment ---hcip1
Introduction to tree and binary tree
Summary of several job scheduling problems
Latex error: missing delimiter (. Inserted) {\xi \left( {p,{p_q}} \right)} \right|}}
Idea SSH channel configuration
MFC document view framework (relationship between classes)
How do microservices aggregate API documents? This wave of show~
随机推荐
/*Rewrite the program, find the value of the element, and return the iterator 9.13: pointing to the found element. Make sure that the program works correctly when the element you are looking for does
Dynamic memory management
Today's sleep quality record 78 points
Container cloud notes
[Galaxy Kirin V10] [server] grub default password
shell awk
Evolution from monomer architecture to microservice architecture
Error C4996 ‘WSAAsyncSelect‘: Use WSAEventSelect() instead or define _ WINSOCK_ DEPRECATED_ NO_ WARN
[Galaxy Kirin V10] [desktop] can't be started or the screen is black
Latex learning insertion number - list of filled dots, bars, numbers
Using Lua to realize 99 multiplication table
Ruby time format conversion strftime MS matching format
[test theory] test phase analysis (unit, integration, system test)
Four characteristics and isolation levels of database transactions
[Galaxy Kirin V10] [desktop] login system flash back
Doris / Clickhouse / Hudi, a phased summary in June
When I forget how to write SQL, I
Student achievement management system (C language)
Virtual machine configuration network
1. Circular nesting and understanding of lists