CSDN博客API

请求网址:“https://mp.csdn.net/postedit/saveArticle

Headers要求数据:

 cookie:用于登录

 content-type:application/x-www-form-urlencoded; charset=UTF-8

Data发送数据:

  1. titl:Test  文章标题

  2. typ:1

  3. cont:<table border="1" cellpadding="1" cellspacing="1" style="width:500px"> <tbody> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> <tr> <td>5</td> <td>6</td> </tr> </tbody> </table> <p>&nbsp;</p>  博客内容

  4. categories:C++ 文章分类

  5. chnl:16

  6. level:0

  7. tag2:   标签

  8. artid:0

  9. private:false

  10. stat:publish 

代码: 

import requests
url = 'https://mp.csdn.net/postedit/saveArticle'
header={
  'cookie':'别想知道我的=.=',
  'content-type':'application/x-www-form-urlencoded; charset=UTF-8'
  }
content='''
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<tbody>
		<tr>
			<td>1</td>
			<td>2</td>
		</tr>
		<tr>
			<td>3</td>
			<td>4</td>
		</tr>
		<tr>
			<td>5</td>
			<td>6</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>
'''
data={
    'titl':'API Test',
    'typ':'1',
    'cont':content,
    'categories':'Test',
    'chnl':'16',
    'level':'0',
    'artid':'0',
    'private':'false',
    'stat':'publish',
    }
res = requests.post(url, headers=header, data=data)
print(res)


结果:

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值