stkvtflw
stkvtflw

Reputation: 13507

How to specify language for x-ray npm webscraping?

Subject of the issue

E.g. i want to scrape a book page from play market. Google market is available in multiple languages without url-specific markers. So, how can i scrape the specific version with language i need instead of random one?

Environment

"x-ray": "^2.2.0"
node --version: 5.9.0
npm --version: 3.7.3

Steps to reproduce

Try to scrape any page from play market. This one for example: https://play.google.com/store/books/details/Walter_Isaacson_Steve_Jobs?id=I6R8MXStPXgC

Expected behaviour

Page is scraped with specific language

Actual behaviour

It scrapes random language (swedish, spanish, portuges - all this while i'm running x-ray from the same VPS)

Upvotes: 0

Views: 63

Answers (1)

Mark Gibaud
Mark Gibaud

Reputation: 2061

You can use a querystring parameter "hl" to define a two-letter language code. So to get the page in Chinese for example, use the url:

https://play.google.com/store/books/details/Walter_Isaacson_Steve_Jobs?id=I6R8MXStPXgC&hl=zh

Note the &hl=zh appended to your original url.

Upvotes: 0

Related Questions