Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import time
- import json
- def get_id2(pid):
- url2 = ('http://www.supremenewyork.com/shop/' + pid + '.json')
- data2 = requests.get(url2).json()
- print('style',url2)
- for sid in data2['styles']:
- print('name',sid['name'],'id',sid['id'])
- def get_id():
- url = 'http://www.supremenewyork.com/shop.json'
- data = requests.get(url).json()
- filename = 'ids.txt'
- with open(filename, 'a+') as rw_af:
- file_url_lst = rw_af.read()
- for category in data['products_and_categories'].values():
- for product_id in category:
- item_id = str(product_id['id'])
- if item_id not in file_url_lst:
- rw_af.write(item_id+'\n')
- get_id2(item_id)
- if __name__ == "__main__":
- get_id()
Add Comment
Please, Sign In to add comment