Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yandex support #547

Open
KeeeeeK opened this issue Aug 1, 2023 · 3 comments
Open

Yandex support #547

KeeeeeK opened this issue Aug 1, 2023 · 3 comments

Comments

@KeeeeeK
Copy link

KeeeeeK commented Aug 1, 2023

Describe the problem you're trying to solve

I like yandex and using my laptop only with keyboard. I'd be happy if there will be support for yandex_search_engine

Describe the solution you'd like

Add yandex support pleeeeas

Describe alternatives you've considered

I tried to make a fork and extend classes as you advised in the description, but I dont know js... I dont know how to write getSearchResults function...(((

@infokiller
Copy link
Owner

Hey, I'm not using it myself so won't be adding it, but I welcome contributions from others (if the code is well written)

@KeeeeeK
Copy link
Author

KeeeeeK commented Aug 2, 2023

Could you please give me some advice about how to extend search_engines.js?

As I understand, method called 'searchBoxSelector' should return a string that somehow filters html code to find search box. If I'm not mistaken, I should just f12 on yandex search page and find class fields that are specific for this box. If it is input class and has class field x='y', then in searchBoxSelector I should return 'input[x="y"]'. Am I right?

getSearchResults function... I looked through how it is written in different cases and the only common pattern is that we should find includedElements and excludedElements, then put them into getSortedSearchResults. I'm a little scared when I see '#search .kp-blk:not(.c2xzTb) .r > a:first-of-type' and absolutely dont understand what it does...

@infokiller
Copy link
Owner

Sorry, missed this. Answers below.

Could you please give me some advice about how to extend search_engines.js?

As I understand, method called 'searchBoxSelector' should return a string that somehow filters html code to find search box. If I'm not mistaken, I should just f12 on yandex search page and find class fields that are specific for this box. If it is input class and has class field x='y', then in searchBoxSelector I should return 'input[x="y"]'. Am I right?

Yes.

getSearchResults function... I looked through how it is written in different cases and the only common pattern is that we should find includedElements and excludedElements, then put them into getSortedSearchResults. I'm a little scared when I see '#search .kp-blk:not(.c2xzTb) .r > a:first-of-type' and absolutely dont understand what it does...

Yes. The expression you quoted is a CSS selector. In some cases (like this one) it's a complex expression because they reflect the structure the webpage of the specific search engine, which are sometimes not easy to parse with CSS selectors. In addition, it is not stable, the website can change their HTML structure any time and break the extension, but there's nothing we can do about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants