dgtlmoon / dgtlmoon/changedetection.io

[feature] custom strings for restock detector

Open
#2,779 2 comments 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
34.1k
Forks
2k
Avg merge
22h 52m
Merged PRs (30d)
70

Description

**Version and OS**
[0.47.06](https://github.com/dgtlmoon/changedetection.io/releases/tag/0.47.06) on linux/docker

**Is your feature request related to a problem? Please describe.**

The problem I am facing is that the list of out-of-stock strings in [stock-not-in-stock.js](https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/content_fetchers/res/stock-not-in-stock.js) does not cover this product: https://www.vagabond.com/es/sheila-5635-001-35

¡Pronto estarán en stock!

**Describe the solution you'd like**

I have thought about just opening a PR with my new use case, but maybe what would be better for the long run would be to allow a custom string to be passed to the "Restock & Price Detection" tab when you configure the URL?

**Describe the use-case and give concrete real-world examples**

The use case is using the restock detector feature to parse the fact that size 39 is out of stock for this URL at this moment:

https://www.vagabond.com/es/sheila-5635-001-35

```html

39


Pronto en stock


```

I could write a CSS selector with the `data-buyable` attribute filtering by the `data-eusize=39` attribute, but this request is about having the restock feature allow me to copy&paste "Pronto estarán en stock" to see that it is not in stock.

I have seen that the page has an ld+json script:

```html

{
"@context": "https://schema.org/",
"@type": "Product",
"name": "SHEILA",
"image": [
"https://cdn.vagabond.com/thumbnails/200/211/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/488/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/596/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/976/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/1336/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/2164/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/211/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/488/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/596/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/976/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/1336/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/2164/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/211/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/488/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/596/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/976/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/1336/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/2164/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/78/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/180/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/220/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/361/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/494/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/800/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/78/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/180/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/220/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/361/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/494/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/800/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/78/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/180/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/220/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/361/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/494/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/800/crop/productimages/pos3/list/5635-001-35.jpg"],
"description": "Sheila son botas de montar minimalistas con un estilo atemporal. El modelo está confeccionado en cuero marrón oscuro con puntera redondeada, caña ancha y cierre de cremallera lateral. Tacón en bloque mide 38 mm. Cuero marrón oscuro Puntera redondeada Caña ancha Cierre con cremallera Tacones de 38mm Para un cuidado duradero: usa crema para zapatos e impermeabilizante para alargar la vida útil del calzado.",
"sku": "5635-001-35",
"brand": {
"@type": "Thing",
"name": "Vagabond Shoemakers"
},
"offers": {
"@type": "Offer",
"url": "https://www.vagabond.com/es/sheila-5635-001-35/",
"priceCurrency": "EUR",
"price": "220.00",
"itemCondition": "https://schema.org/NewCondition",
"availability": "https://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Vagabond International AB"
}
},

"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": 5,
"ratingCount": 3
}
}

```

Unfortunately the item appears as in stock ("availability": "https://schema.org/InStock") because 1 of its variants is, that is there is stock in 2 out of the 7 sizes available. I don't know if this is supposed to be like this in JSON-LD, but it does not make much sense to me since a buyer will usually only buy one variant of the product, so knowing which one is in stock is relevant.

**Additional context**

I am happy to give a go to any changes to the Python side; I am much less comfortable on the JS side of things.

Contributor guide

Open the contributing guide

Research direction

Start with changedetectionio/content_fetchers/res/stock-not-in-stock.js and trace how the Restock & Price Detection tab passes detector settings into the Python side. Reproduce the provided Vagabond HTML and compare current detection with a configurable custom string, including variant-specific behavior. Done means the configured Spanish string is honored without breaking existing stock detection.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.