import requests
import json
url = '
https://adr.meizitu.net/wp-json/wp/v2/posts?page={}&per_page={}'
per_page = 100
page = 52
print('##### spider start #####')
while True:
page += 1
json_data = requests.get(url.format(page, per_page))
data = json.loads(json_data.text)
if not isinstance(data, list):
print('##### spider end #####')
break
for item in data:
thumb_src = item['thumb_src']
title = item['title'] + '.jpg'
print('[+] downloading {} ...'.format(title))
meizi = requests.get(thumb_src)
if meizi.status_code == 200:
with open(title, 'wb') as f:
f.write(meizi.content)