PSSTAudio.com Downloader

This is a simple script that shows you a direct link to audio file that you want to download.

当前为 2021-01-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PSSTAudio.com Downloader
  3. // @description This is a simple script that shows you a direct link to audio file that you want to download.
  4. // @license Creative Commons Zero v1.0 Universal
  5. // @author q2p
  6. // @namespace q2p
  7. // @version 0.3
  8. // @include https://psstaudio.com/post/*
  9. // @grant none
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const page_content = document.getElementsByClassName("page-content")[0];
  16. const card_body = page_content.getElementsByClassName("card-body")[0];
  17. const title = card_body.getElementsByClassName("card-title")[0].textContent;
  18. const description = card_body.getElementsByClassName("card-text")[0].textContent;
  19. const audio = card_body.getElementsByTagName("audio")[0];
  20. const audio_src = audio.firstElementChild.src;
  21.  
  22. const link_container = document.createElement("div");
  23. const link = document.createElement("a");
  24. link.href = audio_src;
  25. link.download = title+" "+description+".mp3";
  26. link.textContent = "Download Link";
  27. link_container.appendChild(link);
  28. card_body.appendChild(link_container);
  29. })();