UrasundayDownloader

Manga downloader for urasunday.com

  1. // ==UserScript==
  2. // @name UrasundayDownloader
  3. // @namespace https://github.com/Timesient/manga-download-scripts
  4. // @version 0.5
  5. // @license GPL-3.0
  6. // @author Timesient
  7. // @description Manga downloader for urasunday.com
  8. // @icon https://urasunday.com/assets/img/favicon.ico
  9. // @homepageURL https://gf.qytechs.cn/scripts/451881-urasundaydownloader
  10. // @supportURL https://github.com/Timesient/manga-download-scripts/issues
  11. // @match https://urasunday.com/title/*
  12. // @require https://unpkg.com/axios@0.27.2/dist/axios.min.js
  13. // @require https://unpkg.com/jszip@3.7.1/dist/jszip.min.js
  14. // @require https://unpkg.com/file-saver@2.0.5/dist/FileSaver.min.js
  15. // @require https://update.gf.qytechs.cn/scripts/451810/1398192/ImageDownloaderLib.js
  16. // @grant GM_info
  17. // @grant GM_xmlhttpRequest
  18. // ==/UserScript==
  19.  
  20. (async function(axios, JSZip, saveAs, ImageDownloader) {
  21. 'use strict';
  22.  
  23. // get title
  24. const title = document.querySelector('body > div.title > div:nth-child(1) > div:nth-child(1)').textContent.trim();
  25.  
  26. // get image urls from document
  27. const urls = await new Promise(resolve => {
  28. GM_xmlhttpRequest({
  29. method: 'GET',
  30. url: window.location.href,
  31. headers: { 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' },
  32. onload: res => resolve(res.response.match(/src: '.*'/gm).map(url => url.split('\'')[1]))
  33. });
  34. });
  35.  
  36. // setup ImageDownloader
  37. ImageDownloader.init({
  38. maxImageAmount: urls.length,
  39. getImagePromises,
  40. title,
  41. positionOptions: { top: '140px' }
  42. });
  43.  
  44. // collect promises of image
  45. function getImagePromises(startNum, endNum) {
  46. return urls
  47. .slice(startNum - 1, endNum)
  48. .map(url => axios
  49. .get(url, { responseType: 'arraybuffer' })
  50. .then(res => res.data)
  51. .then(ImageDownloader.fulfillHandler)
  52. .catch(ImageDownloader.rejectHandler)
  53. );
  54. }
  55.  
  56. })(axios, JSZip, saveAs, ImageDownloader);

QingJ © 2025

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