Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Script say that product is out of stock but not #11

Description

@f1re69

Hello,

i tried to test the script with an available product : https://www.amazon.it/Just-Dance-2021-PlayStation-4/dp/B08HJM7PX6

so i modified the locations object of the script like this :

locations = { 'Just Dance 2021': { 'webshop': 'amazon-it', 'url': 'https://www.amazon.it/Just-Dance-2021-PlayStation-4/dp/B08HJM7PX6', 'inStock': False, 'inStockLabel': "submit.add-to-cart-announce", 'outOfStockLabel': "Non disponibile", 'detectedAsBotLabel': "please contact api-services-support@amazon.com"}, }

then i run the script. Here is what i got : [04:11:04] [ OUT OF STOCK ] [ Just Dance 2021 ]

I tried to do a simple script by myself, and my script can recognize that the product is in stock :

`
from rich.console import Console
import requests
import random

console = Console()
referers = [
'http://www.bing.com/',
'http://www.google.com/',
'https://search.yahoo.com/',
'http://www.baidu.com/',
'https://duckduckgo.com/'
]
referer = random.choice(referers)

with open('resources/user-agents.txt') as f:
user_agents = f.read().splitlines()
f.close()
user_agent = random.choice(user_agents)

headers = {
"User-Agent": user_agent,
"Accept-Encoding": "gzip, deflate",
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'navigate',
'sec-fetch-user': '?1',
'sec-fetch-dest': 'document',
'referer': referer,
"Connection": "close", "Upgrade-Insecure-Requests": "1"
}

inStockLabel = "submit.add-to-cart-announce"

content = requests.get('https://www.amazon.it/Just-Dance-2021-PlayStation-4/dp/B08HJM7PX6', timeout=5, headers=headers).content.decode('utf-8')

if (inStockLabel in content ):
console.log("OMG, IN STOCK!")
`

then i finally got :
[04:15:46] OMG, IN STOCK!

Do you know if it's normal or not ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions