Exemplo n.º 1
0
        #print(ItemName)
        SoldOut = True
        sizeString = ''
        for variant in product['variants']:
            #print(variant['available'])
            if variant['available'] == True:
                SoldOut = False
                if sizeString == '':
                    sizeString += variant['title']
                else:
                    sizeString += '|' + variant['title']

        ItemPicture = product['images'][0]['src']
        ItemPrice = '$' + product['variants'][0]['price']
        ItemLink = 'https://kith.com/products/' + product['handle']
        temp = SiteItem(ItemName, ItemColor, SoldOut)

        index = ExistsInList(temp)

        # If item already exists in list
        if index != -1:
            oldSoldOut = ItemList[index].SoldOut

            if SoldOut != oldSoldOut:
                if not SoldOut:
                    try:
                        SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                           'RESTOCK', ItemLink, ItemPicture,
                                           sizeString, webhook)
                        print('[RESTOCK]' + ItemName)
                    except:
Exemplo n.º 2
0
        results = soup.find(id='container')

        item_elems = results.find_all(class_='inner-article')
        for article in item_elems:
            ItemName = article.find(class_='product-name').find(
                class_='name-link').text
            #print(ItemName)
            ItemColor = article.find(class_='product-style').find(
                class_='name-link').text
            SoldOut = IsElementPresent(article)
            ItemLink = 'https://www.supremenewyork.com/' + article.find(
                'a').get('href')
            ItemPicture = 'https:' + article.find('img').get('src')
            #print(ItemPicture)

            temp = SiteItem(ItemName, ItemColor, SoldOut)
            index = ExistsInList(temp)
            if index != -1:
                oldSoldOut = ItemList[index].SoldOut
                oldPrice = ItemList[index].Price
                oldSizes = ItemList[index].Sizes

                if SoldOut != oldSoldOut:
                    if not SoldOut:
                        page2 = requests.get(ItemLink)
                        soup2 = BeautifulSoup(page2.content, 'html.parser')
                        ItemPrice = soup2.find(class_='price').text
                        temp.Price = ItemPrice
                        sizeString = ""
                        sizes = soup2.find(id='cctrl').find_all('option')
                        for size in sizes:
Exemplo n.º 3
0
def ScanStore(filename, collectionLink, webhook, sizeOption, productLink,
              storeName):
    global pageNum
    print('Scanning Store: ' + storeName)
    while True:
        time.sleep(2)
        pageNum += 1

        FileCheck(filename)

        request = requests.get(collectionLink +
                               'products.json?limit=250&page=' + str(pageNum))
        try:
            decodedJson = request.json()
        except Exception:
            print('[ERROR] Unable to parse JSON!!')
            return

        if len(decodedJson['products']) == 0:
            pageNum = 0
            return

        for product in decodedJson['products']:

            #if all(x not in product['vendor'].lower() for x in brands):
            #    continue

            ItemName = product['title']
            ItemColor = product['handle']
            SoldOut = True
            sizeString = ''
            for variant in product['variants']:
                #print(variant['available'])
                if variant['available'] == True:
                    SoldOut = False
                    size = variant[sizeOption]
                    if sizeOption == 'option2':
                        if size is None:
                            size = variant['option1']
                    if size is None:
                        size = 'F'
                    if size not in sizeString:
                        if sizeString == '':
                            sizeString += size
                        else:
                            sizeString += '|' + size

            if product['variants'][0]['featured_image'] is not None:
                ItemPicture = product['variants'][0]['featured_image']['src']
            else:
                try:
                    ItemPicture = product['images'][0]['src']
                except IndexError:
                    ItemPicture = ''
            ItemPrice = '$' + product['variants'][0]['price']
            ItemLink = productLink + product['handle']
            temp = SiteItem(ItemName, ItemColor, SoldOut)

            index = ExistsInList(temp)

            # If item already exists in list
            if index != -1:
                oldSoldOut = ItemList[index].SoldOut

                if SoldOut != oldSoldOut:
                    if not SoldOut:
                        try:
                            SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                               'RESTOCK', ItemLink,
                                               ItemPicture, sizeString,
                                               webhook, storeName,
                                               collectionLink)
                            print('[RESTOCK]' + ItemName)
                            if 'jordan' in ItemName.lower():
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'RESTOCK',
                                                   ItemLink, ItemPicture,
                                                   sizeString, jordan,
                                                   storeName, collectionLink)
                            if 'yeezy' in ItemName.lower():
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'RESTOCK',
                                                   ItemLink, ItemPicture,
                                                   sizeString, yeezy,
                                                   storeName, collectionLink)
                            if 'nike' in ItemName.lower() and (
                                    'sb' in ItemName.lower()
                                    or 'dunk' in ItemName.lower()):
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'RESTOCK',
                                                   ItemLink, ItemPicture,
                                                   sizeString, nikesb,
                                                   storeName, collectionLink)
                            if 'off-white' in ItemName.lower() or (
                                    'off' in ItemName.lower()
                                    and 'white' in ItemName.lower()):
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'RESTOCK',
                                                   ItemLink, ItemPicture,
                                                   sizeString, offwhite,
                                                   storeName, collectionLink)
                        except:
                            print(
                                'ERROR: Couldn\'t send message. Product Type: '
                                + product['product_type'].lower())
                    else:
                        try:
                            SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                               'Sold Out', ItemLink,
                                               ItemPicture, sizeString,
                                               webhook, storeName,
                                               collectionLink)
                            print('[SOLD OUT]' + ItemName)
                            if 'jordan' in ItemName.lower():
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'Sold Out',
                                                   ItemLink, ItemPicture,
                                                   sizeString, jordan,
                                                   storeName, collectionLink)
                            if 'yeezy' in ItemName.lower():
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'Sold Out',
                                                   ItemLink, ItemPicture,
                                                   sizeString, yeezy,
                                                   storeName, collectionLink)
                            if 'nike' in ItemName.lower() and (
                                    'sb' in ItemName.lower()
                                    or 'dunk' in ItemName.lower()):
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'Sold Out',
                                                   ItemLink, ItemPicture,
                                                   sizeString, nikesb,
                                                   storeName, collectionLink)
                            if 'off-white' in ItemName.lower() or (
                                    'off' in ItemName.lower()
                                    and 'white' in ItemName.lower()):
                                SendDiscordMessage(ItemName, ItemColor,
                                                   ItemPrice, 'Sold Out',
                                                   ItemLink, ItemPicture,
                                                   sizeString, offwhite,
                                                   storeName, collectionLink)
                        except:
                            print(
                                'ERROR: Couldn\'t send message. Product Type: '
                                + product['product_type'].lower())
                    ItemList.pop(index)
                    ItemList.append(temp)
            else:
                if not SoldOut:
                    try:
                        SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                           'In Stock', ItemLink, ItemPicture,
                                           sizeString, webhook, storeName,
                                           collectionLink)
                        print('[IN STOCK]' + ItemName)
                        if 'jordan' in ItemName.lower():
                            SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                               'In Stock', ItemLink,
                                               ItemPicture, sizeString, jordan,
                                               storeName, collectionLink)
                        if 'yeezy' in ItemName.lower():
                            SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                               'In Stock', ItemLink,
                                               ItemPicture, sizeString, yeezy,
                                               storeName, collectionLink)
                        if 'nike' in ItemName.lower() and (
                                'sb' in ItemName.lower()
                                or 'dunk' in ItemName.lower()):
                            SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                               'In Stock', ItemLink,
                                               ItemPicture, sizeString, nikesb,
                                               storeName, collectionLink)
                        if 'off-white' in ItemName.lower() or (
                                'off' in ItemName.lower()
                                and 'white' in ItemName.lower()):
                            SendDiscordMessage(ItemName, ItemColor, ItemPrice,
                                               'In Stock', ItemLink,
                                               ItemPicture, sizeString,
                                               offwhite, storeName,
                                               collectionLink)
                    except:
                        print('ERROR: Couldn\'t send message. Product Type: ' +
                              product['product_type'].lower())
                ItemList.append(temp)

        FileWrite(filename)
Exemplo n.º 4
0
                SoldOut = False
                size = variant['title']
                if size not in sizeString:
                    if sizeString == '':
                        sizeString += size
                    else:
                        sizeString += '|' + size
        try:
            ItemPicture = product['images'][0]['src']
        except IndexError:
            ItemPicture = ''

        ItemPrice = '$' + product['variants'][0]['price']
        ItemLink = 'https://shop-usa.palaceskateboards.com/products/' + product[
            'handle']
        temp = SiteItem(ItemName, '', SoldOut)

        index = ExistsInList(temp)

        # If item already exists in list
        if index != -1:
            oldSoldOut = ItemList[index].SoldOut

            if SoldOut != oldSoldOut:
                if not SoldOut:
                    SendDiscordMessage(ItemName, ItemPrice, 'RESTOCK',
                                       ItemLink, ItemPicture, sizeString,
                                       webhook)
                else:
                    SendDiscordMessage(ItemName, ItemPrice, 'Sold Out',
                                       ItemLink, ItemPicture, sizeString,