# -*- coding: utf-8 -*- ‘‘‘ @author: yaleimeng@sina.com @license: (C) Copyright 2020 @desc: 项目描述。 @DateTime: Created on 2020/8/12 at 下午 02:08 by PyCharm ‘‘‘
import time import random import requests as rq from bs4 import BeautifulSoup as bs from urllib.request import urlretrieve as save
def get_1pic(car_page): try: r = rq.get(car_page timeout=8 ) # headers=head info = r.json() photos = [] for ele in info[‘data‘]: line = ‘{}\n‘.format(ele[‘url‘]).replace(‘/__85/‘ ‘/__100/‘) photos.append(line)
with open(‘pics.txt‘ ‘a‘ encoding=‘utf-8‘) as f: f.writelines(pho
评论
共有 条评论