首页 > 其他 > 详细

题图脚本

时间:2021-08-19 22:11:32      阅读:30      评论:0      收藏:0      [点我收藏+]

```python
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
author: Tiebiao Zhang 2021/8/19 8:37
reviewer:
"""
import re
import requests

if __name__ == ‘__main__‘:
url = "https://img.xjh.me/random_img.php"
rsp = requests.get(url)
str1 = rsp.content.decode(‘utf-8‘)
str1 = re.search(r‘alt="(.*?)"‘, str1).group(0).split(‘"‘)[1]
url = "http:" + str1
rsp = requests.request(‘get‘, url)
content = rsp.content
with open(‘1.jpg‘, "wb") as f:
f.write(content) # 将内容写入图片
```

 

题图脚本

原文:https://www.cnblogs.com/tuzichun/p/15163289.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!