Steamworkshop downloader

Downloads Steam Workshop items that really works, replacing the deprecated or free space left from steamworkshop.download

目前為 2023-11-25 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Steamworkshop downloader
  3. // @namespace Violentmonkey Scripts
  4. // @match *://steamcommunity.com/workshop/filedetails/?id=*
  5. // @match *://steamcommunity.com/sharedfiles/filedetails/?id=*
  6. // @version 1.1
  7. // @author https://github.com/InsightiousCoven
  8. // @include *steamcommunity.com/sharedfiles/filedetails/?id=*
  9. // @include *steamcommunity.com/workshop/filedetails/?id=*
  10. // @grant GM_xmlhttpRequest
  11. // @icon https://i1.wp.com/orshid.id/wp-content/uploads/2018/03/cropped-favicon-free-img.png?ssl=1
  12. // @description Downloads Steam Workshop items that really works, replacing the deprecated or free space left from steamworkshop.download
  13. // @license GPL-3.0
  14. // ==/UserScript==
  15.  
  16. // Changelog:
  17. // 2023-11-25: added loading overlay
  18.  
  19. var patt = new RegExp("[0-9]{2,15}");
  20. var id = patt.exec(document.URL)[0];
  21. var baseUrl = "https://steamcommunity.com/sharedfiles/filedetails/?id="
  22.  
  23. if (document.URL.indexOf("steamcommunity.com") != -1) {
  24. if (document.URL.indexOf("workshop") != -1 || document.URL.indexOf("filedetails") != -1) {
  25. if(!id)
  26. alert("CANNOT GET ID!")
  27.  
  28. addMeta();
  29. addWorkshopBtn(id);
  30. }
  31. }
  32.  
  33. function addMeta() {
  34. var meta = document.querySelector('meta[http-equiv="Content-Security-Policy"]');
  35. var allowedUrls = "https://api.ggntw.com https://api.ggntw.com/steam.request"
  36.  
  37. if (meta) {
  38. meta.content += " " + allowedUrls;
  39. } else {
  40. meta = document.createElement('meta');
  41. meta.httpEquiv = "Content-Security-Policy";
  42. meta.content = "connect-src 'self' " + allowedUrls;
  43. document.getElementsByTagName('head')[0].appendChild(meta);
  44. }
  45. }
  46.  
  47. function SBS_NW(url) {
  48. console.log("DOWNLOADING: "+url)
  49. GM_xmlhttpRequest({
  50. anonymous: true,
  51. method: "POST",
  52. url: "https://api.ggntw.com/steam.request",
  53. data: JSON.stringify({url}),
  54. headers: {
  55. "Content-Type": "application/json",
  56. "User-Agent":"insomnia/2023.5.8"
  57. },
  58. onprogress: () => {},
  59. responseType: "json",
  60. onload: response => {
  61. console.log("success!", {response})
  62. window.open(response.response.url,"_blank")
  63.  
  64. // Remove the loading popup when done
  65. var loadingPopupToRemove = document.getElementById('dwn_loading');
  66. loadingPopupToRemove.parentNode.removeChild(loadingPopupToRemove);
  67.  
  68. },
  69. onerror: reponse => {
  70. // Remove the loading popup when done
  71. var loadingPopupToRemove = document.getElementById('dwn_loading');
  72. loadingPopupToRemove.parentNode.removeChild(loadingPopupToRemove);
  73. alert('error')
  74. }
  75. });
  76. }
  77. function addWorkshopBtn(id) {
  78. var element = document.getElementById("AddToCollectionBtn");
  79. var button = document.createElement('span');
  80. button.setAttribute('class', 'general_btn share tooltip');
  81.  
  82. button.innerHTML = '<span id="SUBS_TO_ITEM"><span>Download this ⬇️</span></span>';
  83. button.onclick = function() {
  84. // Create a loading popup
  85. var loadingPopup = document.createElement('div');
  86. loadingPopup.setAttribute("id","dwn_loading");
  87. loadingPopup.setAttribute('style', 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; display: flex; justify-content: center; align-items: center;');
  88. loadingPopup.innerHTML = '<span style="color: white; font-size: 2em;">Downloading...</span>';
  89. document.body.appendChild(loadingPopup);
  90.  
  91. SBS_NW(baseUrl+id);
  92.  
  93. }
  94.  
  95. if (element.nextSibling) {
  96. element.parentNode.insertBefore(button, element.nextSibling);
  97. } else {
  98. element.parentNode.appendChild(button);
  99. }
  100. document.querySelectorAll(".game_area_purchase_game")[0].getElementsByTagName('h1')[0].setAttribute('style', 'width: 300px;');
  101. }
  102.  

QingJ © 2025

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