PSSTAudio.com Downloader

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

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);
})();