-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbookmarklet-yandex-search.js
52 lines (44 loc) · 2.09 KB
/
bookmarklet-yandex-search.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
organic = '';
paid = '';
related = '';
suggested = '';
intent = '';
nodes = document.querySelectorAll(".serp-list li.serp-item");
list = [].slice.call(nodes);
for (i=0; i<list.length; i++) {
if (list[i].innerHTML.includes('organic__content-wrapper')) {
if (list[i].querySelector('h2 a').href.includes('yabs.yandex.ru')) {
paid = paid + list[i].querySelector('h2 a').innerText + '<br>';
paid = paid + list[i].querySelector('.organic__subtitle').innerText + '<br>';
paid = paid + list[i].querySelector('h2 a').href + '<br>';
paid = paid + list[i].querySelector('.organic__content-wrapper').innerText + '<br>';
paid = paid + '<br><br>';
} else {
organic = organic + list[i].querySelector('h2 a').innerText + '<br>';
organic = organic + list[i].querySelector('.organic__subtitle').innerText + '<br>';
organic = organic + list[i].querySelector('h2 a').href + '<br>';
if (list[i].querySelector('.organic__content-wrapper').innerHTML.includes('extended-text__full')) {
organic = organic + list[i].querySelector('.extended-text__full').innerText + '<br>';
} else {
organic = organic + list[i].querySelector('.organic__content-wrapper').innerText + '<br>';
}
organic = organic + '<br><br>';
}
} else {
intent = intent + list[i].getAttribute('data-fast-wzrd') + ' / ' + list[i].getAttribute('data-fast-subtype') + '<br>';
}
}
nodes = document.querySelectorAll(".related__item");
list = [].slice.call(nodes);
for (i=0; i<list.length; i++) {
related = related + list[i].querySelector('a').innerText + '<br>';
}
nodes = document.querySelectorAll(".mini-suggest__item");
list = [].slice.call(nodes);
for (i=0; i<list.length; i++) {
suggested = suggested + list[i].innerText + '<br>';
}
yandexSERP = "<html><head><title>Yandex SERP</title></head><body><h1>ORGANIC SEARCH</h1>" + organic + "<hr><h1>PAID SEARCH</h1>" + paid + "<hr><h1>RICH SNIPPETS</h1>" + intent + "<br><br><hr><h1>SUGGESTIONS</h1>" + suggested + "<br><br><hr><h1>RELATED</h1>" + related + "<br><br></body></html>";
yandexWindow = window.open();
yandexWindow.document.write(yandexSERP);
yandexWindow.document.close();