user13115879
user13115879

Reputation:

to how can I do web scraping to get prices for my products which I have ony google spreadsheet? dynamically queries

could you please give me an idea about how I can get thi

Upvotes: 0

Views: 460

Answers (3)

E.Wiest
E.Wiest

Reputation: 5915

A workaround. You can import the data with the following script (credits to Brad Jasper) : ImportJSON, then request with QUERY formula. This is an example with "iPhone 8" and "Playstation 4".

ijs

In column A, you write the product to search. The url to get the JSON data is automatically build in column B with a concat operator.

="https://wss2.cex.uk.webuy.io/v3/boxes?q="&A2

In column C, you have the QUERY formula combined with the ImportJSON data step.

=QUERY(ImportJSON(B2);"SELECT Col4,Col20 WHERE Col4 CONTAINS 'Plus' AND Col4 CONTAINS '64' AND Col4 CONTAINS 'Unlocked' LIMIT 1 label Col4'',Col20''";1)

Col4 : product description, Col20 : price of the product. Since the JSON will return a lot of results (multiple iPhone 8 versions), this is the step where you can refine your search. I've searched for "Plus","64" and "Unlocked" in the product description.

Upvotes: 0

MattKing
MattKing

Reputation: 7783

Many sites go to great lengths to actively prevent scraping. Giving you just the data you want entirely undermines their business model. If you're a consumer, they're denied the chance to show you advertising. If you're a reseller, you can use fairly simple programming and marketing to undercut their prices.

If you find yourself unable to scrape, it may be because it's not going to be possible.

Upvotes: 1

player0
player0

Reputation: 1

unfortunately, that won't be possible because the site is controlled by JavaScript and Google Sheets can't understand/import JS. you can test this simply by disabling JS for a given link and you will see a blank page:

0

Upvotes: 0

Related Questions