当前位置:网站首页>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')
边栏推荐
- Snake (C language)
- [untitled]
- Evolution from monomer architecture to microservice architecture
- From programmers to large-scale distributed architects, where are you (2)
- Huge number multiplication (C language)
- Does any teacher know how to inherit richsourcefunction custom reading Mysql to do increment?
- Article publishing experiment
- Application and Optimization Practice of redis in vivo push platform
- Three schemes of ZK double machine room
- [Galaxy Kirin V10] [server] NFS setup
猜你喜欢
Huge number (C language)
Reasons and solutions for the 8-hour difference in mongodb data date display
OSPF summary
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
[test theory] test process management
When I forget how to write SQL, I
VLAN part of switching technology
Vs201 solution to failure to open source file HPP (or link library file)
Error C4996 ‘WSAAsyncSelect‘: Use WSAEventSelect() instead or define _ WINSOCK_ DEPRECATED_ NO_ WARN
[Galaxy Kirin V10] [server] system partition expansion
随机推荐
TS type gymnastics: illustrating a complex advanced type
Snake (C language)
Personal thoughts on the development of game automation protocol testing tool
Pod management
[Galaxy Kirin V10] [desktop and server] FRP intranet penetration
Write a program to judge whether the two arrays are equal, and then write a similar program to compare the two vectors.
Rhcsa12
Basic data types of MySQL
Virtual machine configuration network
Native div has editing ability
DDL language of MySQL database: create, modify alter, delete drop of databases and tables
Batch distribution of SSH keys and batch execution of ansible
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 1
Student achievement management system (C language)
[Galaxy Kirin V10] [server] failed to start the network
Dos:disk operating system, including core startup program and command program
Knapsack problem and 0-1 knapsack problem
Error C4996 ‘WSAAsyncSelect‘: Use WSAEventSelect() instead or define _ WINSOCK_ DEPRECATED_ NO_ WARN
/*The rewriter outputs the contents of the IA array. It is required that the type defined by typedef cannot be used in the outer loop*/
BGP advanced experiment