Advertisement
Guest User

Untitled

a guest
Jul 17th, 2022
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. // ==UserScript==
  2. // @name EmuParadise Download Workaround
  3. // @version 1.2.2
  4. // @description Replaces the download button link with a working one
  5. // @author infval (Eptun)
  6. // @match https://www.emuparadise.me/*/*/*
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. // https://www.reddit.com/r/Piracy/comments/968sm6/a_script_for_easy_downloading_of_emuparadise_roms/
  11. (function() {
  12. 'use strict';
  13.  
  14. // Others: 50.7.189.186
  15. const ipDownload = "50.7.92.186";
  16. const urlFirstPart = "http://" + ipDownload + "/happyxhJ1ACmlTrxJQpol71nBc/";
  17.  
  18. var platform = document.URL.split("/")[3];
  19.  
  20. if (platform == "Sega_Dreamcast_ISOs") {
  21. let downs = document.querySelectorAll("p > a[title^=Download]");
  22. for (let i = 0; i < downs.length; i++) {
  23. let findex = 9; // "Download X"
  24. let lindex = downs[i].title.lastIndexOf(" ISO");
  25. downs[i].href = urlFirstPart + "Dreamcast/" + downs[i].title.slice(findex, lindex);
  26. }
  27. }
  28. // match https://www.emuparadise.me/magazine-comic-guide-scans/%NAME%/%ID%
  29. else if (platform == "magazine-comic-guide-scans") {
  30. const webArchiveURL = "https://web.archive.org/web/2016/";
  31.  
  32. let down = document.querySelectorAll("#content > p")[0];
  33. down.innerHTML = "Getting Download URL...";
  34.  
  35. let req = new XMLHttpRequest();
  36. req.open('GET', webArchiveURL + document.URL, false);
  37. req.send(null);
  38. if (req.status == 200) {
  39. let lindex = req.responseText.indexOf("Size: ");
  40. let findex = req.responseText.lastIndexOf("http://", lindex);
  41. let urlLastPart = req.responseText.slice(findex, lindex).match(/\d+\.\d+\.\d+\.\d+\/(.*)"/)[1];
  42. urlLastPart = urlLastPart.replace(/ /g, "%20"); // encodeURI() changes #, e.g. Sonic - The Comic Issue No. 001 Scan
  43. down.innerHTML = "<a href=" + urlFirstPart + urlLastPart + ">Download</a>";
  44. }
  45. else {
  46. let info = document.querySelectorAll("#content > div[align=center]")[0];
  47. let filename = info.children[0].textContent.slice(0, -5); // "X Scan"
  48. let cat = {
  49. "Gaming Comics @ Emuparadise": "may/Comics/",
  50. "Gaming Magazines @ Emuparadise": "may/Mags/"
  51. }[info.children[1].textContent] || "";
  52. // URLs with # except The Adventures Of GamePro Issue
  53. down.innerHTML = "Error when getting URL: " + webArchiveURL + document.URL
  54. + "<div>Try "
  55. + "<a href=" + urlFirstPart + cat + encodeURIComponent(filename) + ".cbr" + ">cbr</a> or "
  56. + "<a href=" + urlFirstPart + cat + encodeURIComponent(filename) + ".rar" + ">rar</a>"
  57. + "</div>";
  58. }
  59. }
  60. else {
  61. let id = document.URL.split("/")[5];
  62.  
  63. let downloadLink = document.getElementsByClassName("download-link")[0];
  64. let div = document.createElement("div");
  65. div.innerHTML = `<a target="_blank" href="/roms/get-download.php?gid=` + id
  66. + `&test=true" title="Download using the workaround script">Download using the workaround script</a>\
  67. (Right-click, "Save Link As...")<br/>\
  68. You have to change a URL protocol to HTTP! Example: <b>https</b>://50.7.189.186/.../Mario.7z -> <b>http</b>://50.7.189.186/.../Mario.7z`;
  69. downloadLink.insertBefore(div, downloadLink.firstChild);
  70. }
  71.  
  72. })();
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement