当前位置:网站首页>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')
边栏推荐
- Es advanced series - 1 JVM memory allocation
- Button wizard business running learning - commodity quantity, price reminder, judgment Backpack
- 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
- Summary of several job scheduling problems
- Recursive method to achieve full permutation (C language)
- Read a piece of text into the vector object, and each word is stored as an element in the vector. Convert each word in the vector object to uppercase letters. Output the converted elements in the vect
- RHCE day 3
- Linked list operation can never change without its roots
- Huge number multiplication (C language)
- Ruby time format conversion strftime MS matching format
猜你喜欢

183 sets of free resume templates to help everyone find a good job

Rhcsa day 10 operation
![[Galaxy Kirin V10] [desktop and server] FRP intranet penetration](/img/54/7d1b8b7b8226e2820635dd04b92d1c.jpg)
[Galaxy Kirin V10] [desktop and server] FRP intranet penetration
![[Galaxy Kirin V10] [desktop] cannot add printer](/img/a6/28e4aa31e805a018e6db2b32ca1be0.jpg)
[Galaxy Kirin V10] [desktop] cannot add printer

leetcode1-3

Knapsack problem and 0-1 knapsack problem

Summary of several job scheduling problems

Realsense of d435i, d435, d415, t265_ Matching and installation of viewer environment

From programmers to large-scale distributed architects, where are you (2)

Delayed message center design
随机推荐
Collection of practical string functions
[Galaxy Kirin V10] [server] NUMA Technology
Write a program to judge whether the two arrays are equal, and then write a similar program to compare the two vectors.
Rhcsa day 10 operation
DML statement of MySQL Foundation
Quick sort (C language)
Learning XML DOM -- a typical model for parsing XML documents
Realsense d435 d435i d415 depth camera obtains RGB map, left and right infrared camera map, depth map and IMU data under ROS
The bamboo shadow sweeps the steps, the dust does not move, and the moon passes through the marsh without trace -- in-depth understanding of the pointer
Rhcsa day 9
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
RHCE - day one
[testing theory] thinking about testing profession
Es advanced series - 1 JVM memory allocation
1. Circular nesting and understanding of lists
Write a program to define an array with 10 int elements, and take its position in the array as the initial value of each element.
OSPF comprehensive experiment
TS type gymnastics: illustrating a complex advanced type
Recursive method to achieve full permutation (C language)
[Galaxy Kirin V10] [server] set time synchronization of intranet server