Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, json, time, dhooks
- from dhooks import Webhook, Embed
- products = []
- prices = []
- images = []
- new_item_index = []
- new_prices = []
- lengths = []
- prod = None
- price = None
- image = None
- new = None
- index = 0
- hook = Webhook('https://discordapp.com/api/webhooks/579422749563289611/Vi60bdgMCzB1QdjA4se8W3PJMNvEQDAzBnQgktkfsGoN9wi7DqXQOtuNjdnwCE_wAS_g')
- url = 'https://www.supremenewyork.com/mobile_stock.json'
- r = requests.get(url).json()['products_and_categories']
- categories = ['Accessories', 'Pants', 'Sweatshirts', 'Bags', 'Tops/Sweaters', 'Shorts', 'Shirts', 'Hats', 'Jackets', 'Skate', 'new']
- options = '''
- 1. Accessories
- 2. Pants
- 3. Sweatshirts
- 4. Bags
- 5. Tops/Sweaters
- 6. Shorts
- 7. Shirts
- 8. Hats
- 9. Jackets
- 10. Skate
- '''
- choice = input("Do you want to find out the information about every product in a specific category? (information) or the number of products in all categories? (number)")
- if choice == "information":
- while True:
- try:
- number = int(input(options + '\n Type the number for the category you want: '))
- except ValueError:
- print("Sorry, I didn't understand that.")
- continue
- if number < 1 or number > 10:
- print("Sorry, this is not a valid response.")
- continue
- else:
- break
- category = categories[number-1]
- print(category)
- for p in r[category]:
- print("Product: {}".format(p['name']))
- products.append(p['name'])
- print("Price: {}".format(p['price']))
- prices.append('$' + str(p['price']))
- print("Image URL: {}".format(p['image_url_hi']))
- images.append("https:" + p['image_url_hi'])
- print("New Item? {}".format(p['new_item']))
- new_item_index.append(p['new_item'])
- print("------------------------------")
- for p in prices:
- new_prices.append(p[:-2] + '.' + p[-2:])
- for i in range(0,len(products)):
- prod = products[index]
- price = new_prices[index]
- image = images[index]
- new = new_item_index[index]
- embed = Embed(
- description='Supreme Product Scraper',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Monitor')
- embed.add_field(name='Product', value=prod)
- embed.add_field(name='Price', value=price)
- embed.add_field(name='New product?', value=new)
- embed.set_footer(text='Supreme Scraper by @Hunterkicks')
- hook.send(embed=embed)
- index += 1
- else:
- for p in r['Accessories']:
- products.append(p['name'])
- answer = ("The number of products in Accessories is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Pants']:
- products.append(p['name'])
- answer = ("The number of products in Pants is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Sweatshirts']:
- products.append(p['name'])
- answer = ("The number of products in Sweatshirts is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Tops/Sweaters']:
- products.append(p['name'])
- answer = ("The number of products in Tops/Sweaters is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Shorts']:
- products.append(p['name'])
- answer = ("The number of products in Shorts is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Shirts']:
- products.append(p['name'])
- answer = ("The number of products in Shirts is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Hats']:
- products.append(p['name'])
- answer = ("The number of products in Hats is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Jackets']:
- products.append(p['name'])
- answer = ("The number of products in Jackets is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
- for p in r['Skate']:
- products.append(p['name'])
- asnwer = ("The number of products in Skate is " + str(len(products)))
- embed = Embed(
- description='Supreme Product Counter',
- color=24576,
- timestamp='now'
- )
- embed.set_author(name='Product counter')
- embed.add_field(name='----------', value=answer)
- hook.send(embed=embed)
- products.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement