Archived
1
0
Fork 0

Add newegg support (#14)

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-03-01 17:41:41 +01:00
parent 443fbd9106
commit 92b991c042
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7

14
newegg.fql Normal file
View file

@ -0,0 +1,14 @@
LET first_page = 'https://www.newegg.com/p/pl?N=100007709%208000%204841'
LET doc = DOCUMENT(first_page, {driver: "cdp"})
FOR el IN ELEMENTS(doc, "div .item-cell")
LET a = ELEMENT(el, "div .item-title")
LET price = TO_FLOAT(SUBSTITUTE(SUBSTITUTE(TRIM(INNER_TEXT(ELEMENT(el, "div .price-current"))), '$', ''), ',', ''))
LET available = !ELEMENT_EXISTS(el, "div .item-promo")
RETURN {
name: TRIM(LEFT(INNER_TEXT(a), 100)),
url: a.attributes.href,
price: price,
price_currency: "USD",
available: available,
}