skoniks

Knigindom.ru book loader

Nov 25th, 2020
459
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // knigindom.ru book loader
  2. function load(book = 0, page = 1, text = '') {
  3.     console.log('Loading ' + page + ' page')
  4.     $.get('/read/?book='+ book + '&page=' + page, function(data) {
  5.         console.log('Page ' + page + ' loaded')
  6.         let next = parseInt($(data).find('.readlink').last().attr('href').split('=').slice(-1)[0]);
  7.         text += '\n' + $(data).find('#bookread').text();
  8.         if (next > page) {
  9.             load(book, next, text);
  10.         } else {
  11.             console.log(text);
  12.         }
  13.     });
  14. }
  15. load(999);
  16. // 999 - book id
RAW Paste Data