```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) # 将内容写入图片
```