当前位置:网站首页>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')
边栏推荐
- 2022 ape circle recruitment project (software development)
- Rhcsa learning practice
- 【Day2】 convolutional-neural-networks
- Es advanced series - 1 JVM memory allocation
- Tables in the thesis of latex learning
- Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 1
- C language - stack
- Es entry series - 6 document relevance and sorting
- [test theory] test phase analysis (unit, integration, system test)
- Time complexity and space complexity
猜你喜欢

Rhcsa day 10 operation

Evolution from monomer architecture to microservice architecture

Huge number (C language)

Linked list operation can never change without its roots

Personal thoughts on the development of game automation protocol testing tool
![[Galaxy Kirin V10] [server] system partition expansion](/img/49/5d3e28eab45d300bd5695e47b35e6b.jpg)
[Galaxy Kirin V10] [server] system partition expansion

DDL statement of MySQL Foundation

Reprint: summation formula of proportional series and its derivation process

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

Rhsca day 11 operation
随机推荐
Rhcsa day 9
Reprint: summation formula of proportional series and its derivation process
[Galaxy Kirin V10] [desktop] build NFS to realize disk sharing
Native div has editing ability
When I forget how to write SQL, I
Leetcode48. Rotate image
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
Unittest+airtest+beatiulreport combine the three to make a beautiful test report
[Galaxy Kirin V10] [server] set time synchronization of intranet server
/*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*/
VI text editor and user rights management, group management and time management
Linked list operation can never change without its roots
Learning XML DOM -- a typical model for parsing XML documents
MPLS: multi protocol label switching
Development guidance document of CMDB
[Galaxy Kirin V10] [server] system startup failed
PHP code audit 3 - system reload vulnerability
On binary tree (C language)
Sword finger offer 31 Stack push in and pop-up sequence
[test theory] test process management