PSSTAudio.com Downloader

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        PSSTAudio.com Downloader
// @description This is a simple script that shows you a direct link to audio file that you want to download.
// @license     Creative Commons Zero v1.0 Universal
// @supportURL  https://github.com/q2p/PSSTAudio-Link-Exporter
// @author      q2p
// @namespace   q2p
// @version     0.4
// @include     https://psstaudio.com/post/*
// @include     https://www.psstaudio.com/post/*
// @grant       none
// @run-at      document-end
// ==/UserScript==

(function() {
	'use strict';
	const page_content = document.getElementsByClassName("page-content")[0];
	const card_body = page_content.getElementsByClassName("card-body")[0];
	const title = card_body.getElementsByClassName("card-title")[0].textContent;
	const description = card_body.getElementsByClassName("card-text")[0].textContent;
	const audio = card_body.getElementsByTagName("audio")[0];
	const audio_src = audio.firstElementChild.src;

	const link_container = document.createElement("div");
	const link = document.createElement("a");
	link.href = audio_src;
	link.download = title+" "+description+".mp3";
	link.textContent = "Download Link";
	link_container.appendChild(link);
	card_body.appendChild(link_container);
})();