当前位置:网站首页>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')
边栏推荐
- [Galaxy Kirin V10] [server] set time synchronization of intranet server
- 183 sets of free resume templates to help everyone find a good job
- [Galaxy Kirin V10] [desktop] login system flash back
- PHP code audit 3 - system reload vulnerability
- OSPF summary
- The future education examination system cannot answer questions, and there is no response after clicking on the options, and the answers will not be recorded
- Doris / Clickhouse / Hudi, a phased summary in June
- Today's sleep quality record 78 points
- Rhcsa operation
- If you don't know these four caching modes, dare you say you understand caching?
猜你喜欢

Introduction to tree and binary tree

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

Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address

Huge number (C language)

Introduction to extensible system architecture

VLAN part of switching technology

MPLS: multi protocol label switching

Add t more space to your computer (no need to add hard disk)

Doris / Clickhouse / Hudi, a phased summary in June

Rhcsa learning practice
随机推荐
Online troubleshooting
Realsense d435 d435i d415 depth camera obtains RGB map, left and right infrared camera map, depth map and IMU data under ROS
Student achievement management system (C language)
Two way process republication + routing policy
Native div has editing ability
[Galaxy Kirin V10] [desktop] can't be started or the screen is black
Dos:disk operating system, including core startup program and command program
Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
Virtual machine configuration network
leetcode842. Split the array into Fibonacci sequences
Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
Occasional pit compiled by idea
Seven examples to understand the storage rules of shaped data on each bit
[Galaxy Kirin V10] [server] set time synchronization of intranet server
Write a program that uses pointers to set all elements of an int array to 4.18: 0.
Does any teacher know how to inherit richsourcefunction custom reading Mysql to do increment?
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
Ruby time format conversion strftime MS matching format
MFC document view framework (relationship between classes)