Hari-Nagarajan / fairgame

Tool to help us buy hard to find items.
GNU General Public License v3.0
2.44k stars 805 forks source link

Fix getting asin from html tree. Update chromedriver to latest available. #823

Closed SalvadorSTM closed 3 years ago

SalvadorSTM commented 3 years ago

Before, no asin existed in tree.text_content(), so the regex search will be performed onhtml.tostring(tree) now which includes the entire html page. Modified the regex query for this purpose. A bit dirty but this will avoid future errors when amazon decides to update again as long as they maintain the pattern "asin":"asinvalue". Also updated the chromedriver version to the latest one available.

DakkJaniels commented 3 years ago

What's the element it is pulling the ASIN from with this?

DakkJaniels commented 3 years ago

I mean, I know it's regex, but where in the html is that particular pattern located.

SalvadorSTM commented 3 years ago

Right next to the oids.

New Regex String asin\s?\"?\:?\s?\"?([A-Z0-9]+)\"?

Sample String {"refTag":"aod_dpdsk_new_0","qty":1,"asin":"B0046O5YMA","oid":"9IIxPPIJjSkkuwixsTj9H2tdDshv%2Bqy4i5r8i3CgqUs1OMVW6i96aet9Hr9Mo2aB%2FBLYqVIbr0GVWZhAUnCTOr%2BetSqtu1ZsX5g8PwxveGNBQrpvjokaZDi8uomxkdzFHFyF0zmkPlIBlycqU10tCw48CyxTYFGn3xXGYxrpsHGY08hOeYhQWBamMttIjRbx","offerIndex":0}

Capturing Group 1 B0046O5YMA

DakkJaniels commented 3 years ago

Alright cool - I'll pull it in. Thanks!