Greasy Fork is available in English.

Discussioni » Richieste di creazione

Simple script request - YouTube

§
Pubblicato: 27/08/2021
Modificato: 27/08/2021

Is it possible to fix https://greasyfork.org/en/scripts/24196-youtube-copy-short-url-to-clipboard or make something similar? I've been trying to figure out what's wrong in this 4 year old script but haven't figured it out.

Thank you

§
Pubblicato: 27/08/2021
Modificato: 27/08/2021

So when you click on 1 you want to copy the link on number 2? image

That's very easy to do if this is what you want.

§
Pubblicato: 27/08/2021
Modificato: 27/08/2021

Thank you for your reply!

Yes, I would like to copy the short youtu.be link when I click 1.

If possible, to modify the orginal non-working one which includes a few other micro-features.

§
Pubblicato: 27/08/2021
Modificato: 27/08/2021


// ==UserScript==
// @name Copy short YT link
// @namespace copyYTURL
// @version 0.1
// @description Click on the video title below the video to copy the short youtube link url.
// @author hacker09
// @match https://www.youtube.com/watch?v=*
// @icon https://www.youtube.com/s/desktop/03f86491/img/favicon.ico
// @run-at document-end
// @grant GM_setClipboard
// ==/UserScript==

(function() {
'use strict';
setTimeout(function(){ //Starts the settimeout function
document.querySelector("h1.title.style-scope.ytd-video-primary-info-renderer").style.cursor = 'pointer'; //Make the YT video title clickable
document.querySelector("h1.title.style-scope.ytd-video-primary-info-renderer").onclick = function(){ //When the video title is clicked
GM_setClipboard('https://youtu.be/'+location.href.split('watch?v=')[1]); //Copy the short YT link
} //Finishes the onclick function
}, 3000); //Finishes the settimeout function
})();

§
Pubblicato: 27/08/2021

Man, this whole thread is such a weird synchronicity, I literally discovered this same exact old script mere days ago and it was in my mental to do to list to fix after I too found it didn't work.

But yeah, danke hacker09. I was considering the additional function of clicking for the timestamped shortlink, aaand idk maybe I'll attempt to do this myself (that being said I literally know how to do nothing, just trying to teach myself with random arbitrary script making challenges and such) but uhh hey if ya wanna just uhh you know umm do it for me lol...

Seriously though, thanks in any case.

§
Pubblicato: 28/08/2021

Thank you @hacker09 !

§
Pubblicato: 28/08/2021

@Bisquick69


// ==UserScript==
// @name Copy short YT link + timestamp
// @namespace copyYTURL
// @version 0.1
// @description Click on the video title below the video to copy the short youtube link url.
// @author hacker09
// @match https://www.youtube.com/watch?v=*
// @icon https://www.youtube.com/s/desktop/03f86491/img/favicon.ico
// @run-at document-end
// @grant GM_setClipboard
// ==/UserScript==

(function() {
'use strict';
setTimeout(function(){ //Starts the settimeout function
document.querySelector("h1.title.style-scope.ytd-video-primary-info-renderer").style.cursor = 'pointer'; //Make the YT video title clickable
document.querySelector("h1.title.style-scope.ytd-video-primary-info-renderer").onclick = function(){ //When the video title is clicked
GM_setClipboard('https://youtu.be/' + location.href.split('watch?v=')[1] + '?t=' + String(document.getElementById("movie_player").getCurrentTime()).split('.')[0] ); //Copy the short YT link
} //Finishes the onclick function
}, 4000); //Finishes the settimeout function
})();


Thank you @hacker09 !

You're welcome!

§
Pubblicato: 02/09/2021

Oh man awesome, I had just spent 10 minutes trying to figure out the API to do this, finally got the console to at least give me back the timestamp (had to do the document.getElementById which is not included in the API instructions and I am idiot) but that made me recall this thread and I said hey maybe hacker09 rules even more than already established, and BOOM, yep it's true folks, THANK YOU @hacker09!! The userscript writer we need but don't deserve, tremendous, a lot of people are saying this.

§
Pubblicato: 02/09/2021
Modificato: 02/09/2021

@Bisquick69

You're welcome!

A lot of people? hahaha seriously?
I just meet once here and there someone that's very grateful for the scripts I make.
I wish I could know who all this people are hahaha.

Pubblica risposta

Accedi per pubblicare una risposta.