更多地址:siyudizhi.com 移动端:m.xheel.com(不要使用中国移动网络、不要使用国内浏览器)
联系管理员
站内资源批量下载工具加入丝域VIP会员,全站免费看图使用推广功能,快速赚取金币全站禁止发布二次水印图片
新手贴图教程(新手必看)论坛总版规,发帖回帖必看违规及色情等不良信息举报打击色情信息专项整治行动
获取金币的各种方法论坛常见问题汇总丝域地址发布页自助加入VIP会员(220/年)
返回列表 发帖

[2022-01-28] 利用PYTHON爬取ARTOFGLOSS的免费预览图(目前有近万张)

[2022-01-28] 利用PYTHON爬取ARTOFGLOSS的免费预览图(目前有近万张)

# coding=utf-8

import time
import wget
import requests as req
import re

def get_images(_imgnumber):
    '''
    用于得到图片的地址并下载
    '''
    requestUrl = "https://www.artofgloss.net/preview/displayimage.php?album=lastup&cat=0&pos=" + str(_imgnumber)
    attempts = 0
    success = False
    while attempts < 3 and not success:
        try:
            resp = req.get(requestUrl)
            success = True
        except:
            time.sleep(5)
            attempts += 1
            if attempts == 3:
                print("\n网页获取失败")
                break

    result = re.search('src="(albums/\S*.jpg)"', resp.text)
    if "thumb" in result.group(1):
        result = re.search('src="(albums/\S*.gif)"', resp.text)
    fullhttp = "https://www.artofgloss.net/preview/" + result.group(1)
    newfullhttp = fullhttp.replace("normal_", "")
    print("\n",_imgnumber)
    print(newfullhttp)
    wget.download(newfullhttp, 'G:/temp')
    if ("00.jpg" in newfullhttp):
        collecthttp = newfullhttp.replace("00.jpg", "02.jpg")
        print("\n", collecthttp)
        try:
            wget.download(collecthttp, 'G:/temp')
        except:
            print("\n文件不存在")

if __name__ == "__main__":
    for imgnumber in range(0, 100):
        get_images(imgnumber)

说明:1.文件默认存储在G:/temp目录下;2.程序默认下载从0-100编号的图片,你可以自行修改for imgnumber in range(0, 100)这条语句里面的起始编号和结束编号。目前可用的编号大概是6000多。

返回列表

≡ 随机精华 ≡

≡ 最新精华 ≡

≡ 最新推荐 ≡

≡ 一周热帖 ≡

网站地图 | 论坛帮助 | 系统设置 | 管理团队 | 论坛统计 | 意见反馈 | 会员列表 | 新帖列表 | 最新回帖