YouTube.com 0.7 - GUI for youtube-dl

Discuss and share scripts and script files...
40k
Posts: 234
Joined: 09 Dec 2011 21:25

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by 40k »

Version 0.3 is up!
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by yusef88 »

great job,after download complete where can i find can the video?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by highend »

You'll find it in the path of the YoutubeGet.xys file (probably <xyscripts>\)...
One of my scripts helped you out? Please donate via Paypal

40k
Posts: 234
Joined: 09 Dec 2011 21:25

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by 40k »

The file should show up in the directory from where the script is activated. Perhaps I should change this to something like user/downloads or perhaps allow the user to select a default directory
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by Marco »

:appl:
Llittle remark(s):
- there are replacement that are not strict regular expressions. I suspect a "standard" replace() / replacelist() could be better in terms of performance and readability. urldecode() also might be your friend (esp lines 19 to 27)

- you could write $Database with heredoc syntax, one entry per line, and then run a replace() to convert <crlf> to |. Reason: the database becomes way more readable and manageable, at least imho

- why you remove punctuation from video title?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

40k
Posts: 234
Joined: 09 Dec 2011 21:25

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by 40k »

Marco wrote::appl:
Llittle remark(s):
- there are replacement that are not strict regular expressions. I suspect a "standard" replace() / replacelist() could be better in terms of performance and readability. urldecode() also might be your friend (esp lines 19 to 27)

- you could write $Database with heredoc syntax, one entry per line, and then run a replace() to convert <crlf> to |. Reason: the database becomes way more readable and manageable, at least imho

- why you remove punctuation from video title?
- I'm studying regular expressions at the moment so I wrote everything in RegEx just for the sake of practice. I will look into the functions you mentioned to see where they could apply

- $Database is a temporary solution as all the information is actually inside the Youtube page source with the exception of bit rates. I was trying to use regular expressions for extraction but my knowledge seems to be too limited for now. $Database should be replaced in the future with a regular expression. Another reason I do not like hardcoded data like that is the moment I publish the script it becomes obsolete and will not catch any new formats introduced by Youtube (admittedly that doe snot happen very often).

- Leaving certain punctuation characters in the filename can have some strange side-effects. For example leaving in ":" will cause the writefile function to fail and leaving in "/" will cause the creation of a folder. "This / is / file" will cause writefile to create file "file" inside folder "is" inside folder "This".

Hope that answers your questions :)
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by klownboy »

Hi 40k, once again very nice script. I did like your previous script also which used VLC, especially the option to download the audio only so I figured I'd combine the new and old scripts. I took the get "title" portion of the new script and melded that into the old script as well. Works great. The end result is below.
youtube.jpg
youtube.jpg (20.47 KiB) Viewed 3720 times
Thanks again 40k for a very handy script, actually two.
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by Marco »

40k wrote:Hope that answers your questions :)
Yes it does :)
Except for punctuation: if you want this video, https://www.youtube.com/watch?v=yhz4A5BCMAA , then parentheses from the name are removed.
According to Wikipedia, https://en.wikipedia.org/wiki/NTFS

Code: Select all

Allowed characters in filenames
[cut]
In Win32 namespace, any UTF-16 code unit (case insensitive) except U+0000 (NUL) / (slash) \ (backslash) : (colon) * (asterisk) ? (Question mark) " (quote) < (less than) > (greater than) and | (pipe)
so your regex for purifying titles should be

Code: Select all

[\x00/\\:\*\?"<>\|]
HTH
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by kotlmg »

i find this youtube download xyplorer script excellent.
while downloading the video, xyplorer is not being minimized as the script is running? can we do download videos on background using this script, so that xyplorer's minimize, maximize and other options are available to the user.

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by Enternal »

kotlmg wrote:i find this youtube download xyplorer script excellent.
while downloading the video, xyplorer is not being minimized as the script is running? can we do download videos on background using this script, so that xyplorer's minimize, maximize and other options are available to the user.
Yeah that's a downside but I believe that's an issue due to XYplorer itself and not the script. It's probably because XYplorer can't really multi-thread so while it's processing the script, it can't be allowed to do anything else?

40k
Posts: 234
Joined: 09 Dec 2011 21:25

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by 40k »

Enternal wrote:
kotlmg wrote:i find this youtube download xyplorer script excellent.
while downloading the video, xyplorer is not being minimized as the script is running? can we do download videos on background using this script, so that xyplorer's minimize, maximize and other options are available to the user.
Yeah that's a downside but I believe that's an issue due to XYplorer itself and not the script. It's probably because XYplorer can't really multi-thread so while it's processing the script, it can't be allowed to do anything else?
kotlmg wrote:i find this youtube download xyplorer script excellent.
while downloading the video, xyplorer is not being minimized as the script is running? can we do download videos on background using this script, so that xyplorer's minimize, maximize and other options are available to the user.
A possible solution to this problem could be to launch a separate instance of Xyplorer to run the download. I'm not sure if this can be down from inside a script but I'll look into it.
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by Enternal »

I'm guess you could use the run command to have it launch another process of XYplorer then. At the same time that probably requires you to have the setting to allow Multiple instances of XYplorer checked on. Then use the exit command without saving to exit that instance of XYplorer when it finishes it?

PeterH
Posts: 2776
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by PeterH »

It's absolutely no problem to start a 2nd XY by script.

But either the first XY waits for termination of the 2nd, or it will not be notified of it's termination.
If that's not problem, then it's just easy.

By the way: of course the 2nd XY can be started with the name of a script that is executed automatically...
W7(x64) SP1 German
( +WXP SP3 )

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by kotlmg »

i have added option to download from the clipboard or type URL

Code: Select all

/****************************************************
*** YoutubeGet main functions		 // 40k		  ***
****************************************************/
"Main"

 $Itag = "";
 $Itags = "";
 $Methode = inputselect(Choose methode for downloading:, "Paste from Clipboard|Type URL", , 2);

	if ($Methode=="Paste from Clipboard"){
  	 	 $YoutubeSource_All = readurl ("<clipboard>");
	} else {
  	 $destination = input("Type URL for download");
	 $YoutubeSource_All = readurl ($destination);
	}
 $RegEx ="<title>.+<\/title>";
 $Title = regexmatches ("$YoutubeSource_All", "$RegEx", "", "0");
 $RegEx ="<title>|<\/title>";
 $Title = regexreplace ("$Title", "$RegEx", "", "0");
 $RegEx = "[^:&;()\/ ]+\b";
 $Title = regexmatches ("$Title", "$RegEx", " ", "0");
 $RegEx = quote("url_encoded_fmt_stream_map"": ""[^""]*", "0");
 $YoutubeSource_StreamMap = regexmatches ("$YoutubeSource_All", "$RegEx", "|", "0");
 $RegEx = "\w+=[^,]+";
 $YoutubeSource_QualityMap = regexmatches ("$YoutubeSource_StreamMap", "$RegEx", "|", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "\\u0026", "&", "0"); 
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "%26", "&", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "%3A", ":", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "%2F", "/", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "%3F", "?", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "%3D", "=", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "%25", "%", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "sig", "signature", "0");
 $YoutubeSource_QualityMap = regexreplace ("$YoutubeSource_QualityMap", "url=", "", "0"); 
 foreach ($Quality, $YoutubeSource_QualityMap, "|"){
  $RegEx = "itag=\d{1,3}";
  $Itags = regexmatches ("$Quality", "$RegEx", "@", "0");
  $Itags = regexreplace ("$Itags", "itag=|@itag=\d+", "", "0");
  $Itag = $Itag.$Itags."|";
 }
 $Database = "240p FLV     0.25+64  h263+mp3 @5|270p FLV     0.80+64  h263+mp3 @6|3GP     0.50+00  mpg4+aac @13|144p 3GP     0.05+24  mpg4+aac @17|270p MP4     0.50+96  h264+aac @18|720p MP4      2.90+192 h264+aac @22|360p FLV     0.50+128 h264+aac @34|480p FLV   1.00+128 h264+aac @35|240p 3GP     0.17+38  mpg4+aac @36|1080p MP4     4.30+192 h264+aac @37|3072p MP4     5.50+192 h264+aac @38|360p WebM  0.50+128 vp80+vob @43|480p WebM  1.00+128 vp80+vob @44|720p WebM   2.00+192 vp80+vob @45|1080p WebM  4.00+192 vp80+vob @46|360p MP4     (3D) 0.5+96 h264+aac @82|240p MP4(3D) 0.5+96 h264+aac @83|720p MP4     (3D) 2.90+152 h264+aac @84|MP4 520p (3D) 2.90+152 h264+aac @85|360p WebM  (3D) 0.00+128 vp80+vob @100|WebM 360p (3D) 0.00+192 vp80+vob @101|720p WebM  (3D) 0.00+192 vp80+vob @102|"; 
 $MenuList = ""; 
 foreach ($Tag, $Itag, "|"){
  $RegEx = "[^|]*@$Tag";
  $i = "";
  $i = regexmatches ("$Database", "$RegEx", "o");
   if ($i != "" && $Tag != ""){
    $MenuList = $MenuList.$i."|";
   }
 }
 $MenuSelection = inputselect ("Select Quality", "$MenuList", "|", "0", , , , );
 $RegEx = "@\d{1,3}";
 $Itag = regexmatches ("$MenuSelection", "$RegEx", "|", "0");
 $Itag = regexreplace ("$Itag", "@", "", "0");
 $RegEx = "[^|""]*itag=$Itag[^|""]*";
 $URL = regexmatches ("$YoutubeSource_QualityMap", "$RegEx", "|", "0");
 $RegEx = "[&]?(type|quality|itag|fallback_host)=[^&]+";
 $URL = regexreplace ("$URL", "$RegEx", "", "0")."&itag=$Itag";
 $RegEx = "[&]?http:[^&]+";
 $HTTP = regexmatches ("$URL", "$RegEx", "", "0");
 $URL = regexreplace ("$URL", "$RegEx", "", "0");
 $HTTP = regexreplace ("$HTTP", "&", "", "0");
 $URL = $HTTP.$URL; // This is the playable URL. Can be used anywhere to access the video
 writefile ("$Title".".mp4", readurl("$URL"), "o", "b");

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: Youtube.com 0.3 (Only requires Xyplorer now)

Post by kotlmg »

the above script is only for youtube videos having size less than 100Mb only. for higher sizes, the script is not getting executed.

Post Reply