This repository has been archived by the owner on Dec 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #84: Improve fallback extraction
Improve fallback extraction by CSS selectors: * Update selectors for the top 5 sites. Add Home Depot and Best Buy. * Rename selectors JSON file to be more descriptive (was 'product_extraction_data.json', now 'fallback_extraction_selectors.json'). * Represent supported sites in 'fallback_extraction_selectors.json' as regular expression strings so that fallback extraction works for any subdomain of the site (e.g. 'smile.amazon.com'). * Represent CSS selectors by tuples in 'fallback_extraction_selectors.json', so that each selector can specify which attribute or property to read for that selector. * Clean price strings from fallback extraction using the same methods as used by Fathom extraction (PR #111); consolidate and move shared methods to 'utils.js'.
- Loading branch information
1 parent
31a9491
commit 0ba13fc
Showing
4 changed files
with
202 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"^https?:\\/\\/([a-zA-Z0-9]+\\.){0,}amazon\\.com": { | ||
"title": [ | ||
["#productTitle", "innerText"], | ||
[".product-title", "innerText"] | ||
], | ||
"price": [ | ||
["#priceblock_dealprice", "innerText"], | ||
["#priceblock_ourprice", "innerText"], | ||
["#price_inside_buybox", "innerText"], | ||
["#buybox .a-color-price", "innerText"], | ||
["input[name='displayedPrice']", "value"], | ||
[".a-size-large.a-color-price.guild_priceblock_ourprice", "innerText"], | ||
[".a-color-price.a-size-medium.a-align-bottom", "innerText"], | ||
[".display-price", "innerText"], [".offer-price", "innerText"] | ||
], | ||
"image": [ | ||
["#landingImage", "src"], | ||
["#imgBlkFront", "src"], | ||
["#ebooksImgBlkFront", "src"] | ||
] | ||
}, | ||
"^https?:\\/\\/([a-zA-Z0-9]+\\.){0,}bestbuy\\.com": { | ||
"title": [ | ||
[".sku-title h1", "innerText"] | ||
], | ||
"price": [ | ||
[".priceView-hero-price.priceView-purchase-price", "innerText"] | ||
], | ||
"image": [ | ||
["img.primary-image", "src"] | ||
] | ||
}, | ||
"^https?:\\/\\/([a-zA-Z0-9]+\\.){0,}ebay\\.com": { | ||
"title": [ | ||
["#itemTitle", "innerText"], | ||
[".product-title", "innerText"] | ||
], | ||
"price": [ | ||
["#prcIsum", "innerText"], | ||
["#orgPrc", "innerText"], | ||
["#mm-saleDscPrc", "innerText"], | ||
[".display-price", "innerText"] | ||
], | ||
"image": [ | ||
["#icImg", "src"], | ||
[".vi-image-gallery__image.vi-image-gallery__image--absolute-center", "src"] | ||
] | ||
}, | ||
"^https?:\\/\\/([a-zA-Z0-9]+\\.){0,}homedepot\\.com": { | ||
"title": [ | ||
["h1.product-title__title", "innerText"] | ||
], | ||
"price": [ | ||
["#ajaxPrice", "content"], | ||
["#ajaxPriceAlt", "innerText"] | ||
], | ||
"image": [ | ||
["#mainImage", "src"] | ||
] | ||
}, | ||
"^https?:\\/\\/([a-zA-Z0-9]+\\.){0,}walmart\\.com": { | ||
"title": [ | ||
["h1.prod-ProductTitle", "content"], | ||
["h1.prod-ProductTitle", "innerText"] | ||
], | ||
"price": [ | ||
[".PriceRange.prod-PriceHero", "innerText"], | ||
[".price-group", "aria-label"], | ||
[".price-group", "innerText"] | ||
], | ||
"image": [ | ||
[".prod-hero-image-image", "src"], | ||
[".prod-hero-image-carousel-image", "src"] | ||
] | ||
}, | ||
"www.mkelly.me": { | ||
"title": [ | ||
["#title", "innerText"] | ||
], | ||
"price": [ | ||
["#price", "innerText"] | ||
], | ||
"image": [ | ||
["img", "src"] | ||
] | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters