TruyenCuaTui downloader

Tải truyện từ truyencuatui.net định dạng epub

  1. // ==UserScript==
  2. // @name TruyenCuaTui downloader
  3. // @namespace https://nntoan.com/
  4. // @description Tải truyện từ truyencuatui.net định dạng epub
  5. // @version 1.0.2
  6. // @icon https://1.bp.blogspot.com/-dKHpsymtdMY/WWhR69EBgOI/AAAAAAAAA4s/bxIb3L0bFxETn-BR6hOewuzZyPnh9ZfGgCLcBGAs/s1600/truyen-cua-tui-logo.png
  7. // @author Toan Nguyen
  8. // @oujs:author nntoan
  9. // @license MIT; https://nntoan.mit-license.org/
  10. // @supportURL https://github.com/nntoan/UserScripts/issues
  11. // @match http://truyencuatui.net/truyen/*
  12. // @match http://truyencuatui.vn/truyen/*
  13. // @match https://truyencuatui.net/truyen/*
  14. // @match https://truyencuatui.vn/truyen/*
  15. // @require https://unpkg.com/jszip@3.2.1/dist/jszip.min.js
  16. // @require https://unpkg.com/ejs@2.6.1/ejs.min.js
  17. // @require https://unpkg.com/jepub@2.1.0/dist/jepub.min.js
  18. // @require https://unpkg.com/file-saver@2.0.2/dist/FileSaver.min.js
  19. // @require https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
  20. // @require https://cdn.jsdelivr.net/gh/nntoan/mbDownloader@0.2.3/src/mbDownloader.min.js
  21. // @connect self
  22. // @run-at document-idle
  23. // @noframes
  24. // ==/UserScript==
  25. /*global console, location*/
  26. (function ($, window, document) {
  27. 'use strict';
  28.  
  29. $(document).ready(function () {
  30. $.widget('nntoan.mbDownloader', $.nntoan.mbDownloader, {
  31. _create: function () {
  32. this._super();
  33.  
  34. // Extending options
  35. this.options.processing.ebookFileName = this.options.general.pathname.slice(8, -5);
  36. this.options.xhr.chapter.url = this.options.xhr.chapter.url + $(this.options.classNames.chapterList).data('href') + '.html';
  37. this.options.xhr.content.url = this.options.general.host + this.options.chapters.chapId;
  38.  
  39. // Styling download button for current site
  40. this.elements.$downloadBtn.attr('class', 'btn btn-lg btn-raised btn-info btn-block btn-downloadepub');
  41.  
  42. console.time('downloadAndGenerateEpub');
  43. },
  44. });
  45.  
  46. $(this).mbDownloader({
  47. readyToInit: true,
  48. processing: {
  49. ebookFileExt: '.epub'
  50. },
  51. regularExp: {
  52. chapter: null,
  53. eoctext: ['(ps:|hoan nghênh quảng đại bạn đọc quang lâm|Huyền ảo khoái trí ân cừu|truyencuatui .net|truyencuatui)', 'i'],
  54. },
  55. classNames: {
  56. novelId: '#form-report > div.modal-footer > input[type=hidden]:nth-child(2)',
  57. infoBlock: '.bo-truyen',
  58. chapterContent: '.chapter-content',
  59. chapterNotContent: 'iframe, script, style, a, div, p:has(a[href*="truyencuatui.net"])',
  60. chapterVip: '#btnChapterVip',
  61. chapterList: '.btn-chapters',
  62. chapterTitle: 'h1.title > span',
  63. ebookTitle: 'h1.title',
  64. ebookAuthor: 'a.list-group-item > span:nth-child(2)',
  65. ebookCover: '.cover',
  66. ebookDesc: '.contentt',
  67. ebookType: 'span.list-group-item:first a',
  68. downloadBtnStatus: 'btn-primary btn-success btn-info btn-warning btn-danger blue success warning info danger error',
  69. downloadAppendTo: 'div.jumbotron > div > div.col-md-8 > p:nth-child(6)',
  70. },
  71. ebook: {
  72. fallbackCover: 'https://3.bp.blogspot.com/-g9DNzD8a38g/WWheUmaCjuI/AAAAAAAAA40/K0dd-XV3Dn0UivI2UzcxkYPz7KkVa4-CQCLcBGAs/s1600/cover.jpg'
  73. },
  74. chapters: {
  75. chapListSlice: [6],
  76. },
  77. xhr: {
  78. chapter: {
  79. type: 'GET',
  80. url: '/chuong/',
  81. },
  82. content: {
  83. type: 'GET',
  84. xhrFields: {
  85. withCredentials: true
  86. }
  87. }
  88. },
  89. bookInfoUpdated: function (event, data) {
  90. var that = data.that,
  91. options = that.options,
  92. $infoBlock = that.elements.$infoBlock;
  93.  
  94. options.ebook = $.extend(options.ebook, {
  95. title: $infoBlock.find(options.classNames.ebookTitle).text().trim(),
  96. author: $infoBlock.find(options.classNames.ebookAuthor).text().trim(),
  97. cover: $infoBlock.find(options.classNames.ebookCover).find('img').attr('src'),
  98. description: $infoBlock.find(options.classNames.ebookDesc).html(),
  99. });
  100.  
  101. data.epubInfo = $.extend(data.epubInfo, options.ebook);
  102.  
  103. console.log('Book information updated...', data.epubInfo);
  104. },
  105. chapIdUpdated: function (event, that) {
  106. var options = that.options;
  107. options.xhr.content.url = location.protocol + '//' + options.general.host + options.chapters.chapId;
  108. },
  109. beforeCreateEpub: function (event, that) {
  110. console.log('Prepare generate epub...');
  111. },
  112. complete: function (event, that) {
  113. console.log('Epub downloaded successfully. Please check your Downloads folder.');
  114. console.timeEnd('downloadAndGenerateEpub');
  115. }
  116. });
  117. });
  118. })(jQuery, window, document); // eslint-disable-line

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址