Awesome Wallpapers - wallhaven.cc
今天用到的网站是一个壁纸网站,图片精美。
import requests import re import os import asyncio import aiohttp import aiofiles def gethtml(url, encode): # 获取网页源码 r = requests.get(url) r.encoding = encode return r.text def mkdir(path): # 创建文件夹 path = path.strip() isExists = os.path.exists(path) if not isExists: os.makedirs(path) def geturl(url): # 获取网站各个分类链接、分类名称 html = gethtml(url, 'utf-8') obj = re.compile(r'.*?)" target="_blank" >', re.S) result = obj.finditer(html) with open('image_path.txt', 'w') as f: for item in result: f.write(item.group('url') + 'n') async def aio_download_pic(session,
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)