public-roadmap icon indicating copy to clipboard operation
public-roadmap copied to clipboard

[Yandex Search API] Results from API are different than via regular search

Open marm123 opened this issue 1 year ago • 5 comments

One of our users reported that they are not getting the same results via SerpApi as they are through regular Yandex searches. I've discovered that the yandex_url contains the rstr parameter, which is always the negative of the lr (ref). I'm not exactly sure what this parameter does, but after removing it, the results are the same as through regular search:

Results with the rstr parameter: image

Results with no rstr parameter (very similar to the ones the user gets with multiple pages of results): image

Public links: Playground

Internal links: Intercom | Search Inspect

marm123 avatar Sep 30 '24 09:09 marm123

Another customer reported this issue.

Expected result: 1a16ce35e1dff0ef5d12f4ccd9dc4869685289c9

received this instead: 58a26ef8ec2c1dc0cfdcd87ce0b79b9ff08494b6

I've tried to switch using different regions, but unfortunately, I can't replicate the original result. Based on the screenshot, customer using lr=10553, which is not available on our supported location.

I tried locally removing the rstr parameter; the result is closer. CleanShot 2024-10-01 at 13 09 08

Internal links: Front | Inspect | Inspect with lr 84

hilmanski avatar Oct 01 '24 04:10 hilmanski

According to multiple russian sources (1, 2, 3):

  • lr - selects search results relevant to specified region
  • rstr - selects search results that include specified region in text snippets/titles on the page

These are 2 different filter strategies, but we set rstr each time lr is filled - that's incorrect.

Also, according to this support thread of A-Parser (our competitor), region based search in Yandex depends not only on lr/rstr, but also yp and yandex_gid that we don't use at all.

ocvit avatar Oct 03 '24 10:10 ocvit

Thanks @ocvit, that makes sense. It's probably because of that we're getting weird locations despite setting the lr parameter, right? Here is the lr set to Moscow, and the language to Russian, but the results are for the New York location:

image

marm123 avatar Oct 03 '24 10:10 marm123

These results are for Moscow. Location in the footer is detected from IP address you make the request from. In some cases, it may affect the search results, but not in this specific example. At this moment, I'm not sure is it possible to fully override it, experimenting with cookies.

Talking about rstr - we should extract it into a separate optional checkbox.

ocvit avatar Oct 03 '24 11:10 ocvit

Oh, ok. Thanks for explaining @ocvit!

marm123 avatar Oct 03 '24 12:10 marm123

Fix has been released.

rstr param is an optional filter now.

Screenshot 2024-10-07 at 11 08 57

ocvit avatar Oct 07 '24 08:10 ocvit