Skip to content

Accelerator086/python-scrapy-csgowallpaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

python-scrapy-csgowallpaper

Python 爬取 http://csgowallpapers.com 全站图片

# -*- coding: utf-8 -*-

import os
import urllib
import time

headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0'
}

final_folder = './csgowallpaper/'
os.makedirs(final_folder, exist_ok=True)

proxies_v2ray = {
'http':'http://127.0.0.1:10809',
'https':'https://127.0.0.1:10809'
}

opener = urllib.request.build_opener(urllib.request.ProxyHandler(proxies_v2ray))
urllib.request.install_opener(opener)

for n in range(1,2746):
    url_original='https://csgowallpapers.com/include/download_wallpaper.php?id='+str(n)
    if os.access(final_folder+'%s.png'%str(n), os.F_OK):
        print('Jump to existed picture no.{}'.format(n))
    else:
        urllib.request.urlretrieve(url_original,final_folder+'%s.png'%str(n))
        print('Finish downloading picture no.{}'.format(n))
        time.sleep(0.5)
print('Finish!')

About

Python 爬取 http://csgowallpapers.com 全站图片

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages