python抓取动态验证码,具体第几帧数的位置静态图片

一.代码+注解

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()
posted @ 2020-07-18 16:53  小小咸鱼YwY  阅读(907)  评论(0编辑  收藏  举报