jQuery(function ($) {
var result = new Map(),
processor = function (ele) {
$("div.sms-number-list.row", ele).each(function (i, e) {
var key = e.querySelector("div>a").href,
val = result.get(key),
text = $.text(e.querySelector("div>h3"));
if (val) {
val.push(text);
} else {
result.set(key, [text]);
}
});
},
$pages = $("ul.pagination>li"),
min = Number($.text($pages[1])),
max = $.text($pages[$pages.length - 2]),
active = $pages.filter(".active").text(),
_continue = true;
for (var i = min; _continue && i <= max; i++) {
if (i == active) {
processor(document);
} else {
$.ajax({
async: false,
url: "https://www.materialtools.com/?page=" + i,
success: function (res) {
processor(res);
},
error: function () {
_continue = false;
console.error(arguments);
}
});
}
}
_continue && console.log(JSON.stringify([...result]));
});
[
[
"https://www.pdflibr.com/SMSContent/1",
[
"+8619965412404",
"+12123630317"
]
]
/* , ... */
]
https://www.pdflibr.com/
https://www.materialtools.com/