一.代码 注解
代码语言:javascript复制import os
from PIL import Image
import requests
import io
def save_img():
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'
}
url = '动图url'
resp = requests.get(url, headers=headers, verify=False)
code = io.BytesIO(resp.content)
im = Image.open(code)
im.seek(3) #第3帧的图片
im.save('1.png') #保存
save_img()