当前位置:网站首页>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')
边栏推荐
- Personal thoughts on the development of game automation protocol testing tool
- /*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*/
- Batch distribution of SSH keys and batch execution of ansible
- /*Write a function to open the file for input, read the contents of the file into the vector container of string class 8.9: type, and store each line as an element of the container object*/
- Online troubleshooting
- PHP programming language (1) - operators
- If the uniapp is less than 1000, it will be displayed according to the original number. If the number exceeds 1000, it will be converted into 10w+ 1.3k+ display
- Rhcsa operation
- Talk about scalability
- Tables in the thesis of latex learning
猜你喜欢

RHCE day 3

Personal thoughts on the development of game automation protocol testing tool

Error C4996 ‘WSAAsyncSelect‘: Use WSAEventSelect() instead or define _ WINSOCK_ DEPRECATED_ NO_ WARN

TS type gymnastics: illustrating a complex advanced type

Collection of practical string functions
![[machine] [server] Taishan 200](/img/e5/69a1a4ca04814a033a77d3cb4601b3.jpg)
[machine] [server] Taishan 200
![[FAQ] summary of common causes and solutions of Huawei account service error 907135701](/img/73/c4ee842475f05e2e67297fcac68779.png)
[FAQ] summary of common causes and solutions of Huawei account service error 907135701

Rhcsa day 10 operation

C language structure to realize simple address book

Summary of several job scheduling problems
随机推荐
Idea SSH channel configuration
DDL language of MySQL database: create, modify alter, delete drop of databases and tables
Sword finger offer 31 Stack push in and pop-up sequence
Rhcsa learning practice
Write a program to judge whether the elements contained in a vector < int> container are 9.20: exactly the same as those in a list < int> container.
【Day2】 convolutional-neural-networks
Basic data types of MySQL
/*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
[Galaxy Kirin V10] [desktop] printer
Learning XML DOM -- a typical model for parsing XML documents
leetcode1229. Schedule the meeting
Software sharing: the best PDF document conversion tool and PDF Suite Enterprise version sharing | with sharing
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
Introduction to tree and binary tree
C language - stack
Rhcsa - day 13
Application and Optimization Practice of redis in vivo push platform
Rhcsa day 9
Es advanced series - 1 JVM memory allocation
[Galaxy Kirin V10] [server] failed to start the network