PSSTAudio.com Downloader

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

当前为 2021-02-12 提交的版本,查看 最新版本

  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. // @supportURL https://github.com/q2p/PSSTAudio-Link-Exporter
  6. // @author q2p
  7. // @namespace q2p
  8. // @version 0.4
  9. // @include https://psstaudio.com/post/*
  10. // @include https://www.psstaudio.com/post/*
  11. // @grant none
  12. // @run-at document-end
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. const page_content = document.getElementsByClassName("page-content")[0];
  18. const card_body = page_content.getElementsByClassName("card-body")[0];
  19. const title = card_body.getElementsByClassName("card-title")[0].textContent;
  20. const description = card_body.getElementsByClassName("card-text")[0].textContent;
  21. const audio = card_body.getElementsByTagName("audio")[0];
  22. const audio_src = audio.firstElementChild.src;
  23.  
  24. const link_container = document.createElement("div");
  25. const link = document.createElement("a");
  26. link.href = audio_src;
  27. link.download = title+" "+description+".mp3";
  28. link.textContent = "Download Link";
  29. link_container.appendChild(link);
  30. card_body.appendChild(link_container);
  31. })();