AYTS - Another YouTube Script

Discuss and share scripts and script files...
Post Reply
highend
Posts: 13316
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

AYTS - Another YouTube Script

Post by highend »

I really love youtube-dl (http://youtube-dl.org/)
An invaluable tool to download video files from a lot of portals (not only youtube)...

It requires:
- youtube-dl (who would have thought that?!?)
- ffmpeg (https://ffmpeg.zeranoe.com/builds/)

Why ffmepg? To fix errors in the downloaded file (it's NOT about transcoding the video
into different formats or extracting the audio...). I have seen this a few times and even
VLC wasn't able to play the downloaded file correctly. With ffmepg this hasn't been
a problem in months...

If AYTS does not find any of these two utilities it will question you if you want to
open their website to download them. You are responsible to extract the ffmpeg
zip and put it's folder + youtube.dl in the correct folders (which you have to
configure at the beginning of the script!

Code: Select all

    $exe         = "D:\Tools\@Command Line Tools\youtube_dl\youtube-dl.exe";
    $ffmpeg      = "D:\Tools\@Command Line Tools\FFmpeg\bin";
    $dstFolder   = "D:\Users\Highend\Downloads";
The script recognizes an url in the clipboard. If there isn't one, it will ask for it
It then downloads the necessary metadata and will show a window where
you can select, what exactly you want to download.

The entry with the suffix "(best)" is preselected by default!
preselected.png
preselected.png (23.37 KiB) Viewed 3521 times
Choose only ONE checkbox here!

Hit the OK button, and the script will download the file to the
destination folder given in the "$dstFolder" variable at the beginning
of the script...

Current version:
Youtube_v0.3.xys
(3.68 KiB) Downloaded 237 times
Old version(s):
Youtube_v0.2.xys
(3.21 KiB) Downloaded 231 times
Youtube_v0.1.xys
(2.89 KiB) Downloaded 208 times
One of my scripts helped you out? Please donate via Paypal

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

Re: AYTS - Another YouTube Script

Post by klownboy »

Hi highend, I'm glad you took the time to update a Youtube downloading script. None of the previous ones were working for me either. However, I'm having a problem getting it to work. I updated to the latest youtube-dl.exe file and ffmepeg and changed the download folder location. It fails after downloading the video meta data as seen on the status bar. I tried numerous URL's all the same result. When stepping through the script, in this line...

Code: Select all

$formats = regexreplace(runret("""$exe"" -F ""$url""", %TEMP%), "\r?\n", <crlf>);
I see this message parsed and resolved...

Code: Select all

regexreplace()
----
[youtube] S1anFPJDto8: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)> (caused by URLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)'),))

----
\r?\n
----
the URL used in the above example...

Code: Select all

https://www.youtube.com/watch?v=S1anFPJDto8
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

highend
Posts: 13316
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: AYTS - Another YouTube Script

Post by highend »

I'm on 2017-12-14 (youtube-dl)

Which version do you use?

When I use your url, it downloads the metadata without problems and shows the window to
select a format to download.

So: https://www.google.se/search?q=youtube- ... sAeGraDADA
Have you scanned them?

E.g.: Internet Options->Content->Clear SSL State helped for some users

And apart from that, open a command prompt in your youtube-dl folder, execute:

Code: Select all

youtube-dl.exe --no-check-certificate -F https://www.youtube.com/watch?v=S1anFPJDto8
Show the output
One of my scripts helped you out? Please donate via Paypal

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

Re: AYTS - Another YouTube Script

Post by klownboy »

I'm using the same (latest) version 2017-12-14. Output with no certification parameter:

Code: Select all

[youtube] S1anFPJDto8: Downloading webpage
[youtube] S1anFPJDto8: Downloading video info webpage
[youtube] S1anFPJDto8: Extracting video information
[youtube] S1anFPJDto8: Downloading MPD manifest
[info] Available formats for S1anFPJDto8:
format code  extension  resolution note
139          m4a        audio only DASH audio   49k , m4a_dash container, mp4a.4
0.5@ 48k (22050Hz), 4.44MiB
249          webm       audio only DASH audio   72k , opus @ 50k, 4.99MiB
250          webm       audio only DASH audio   92k , opus @ 70k, 6.44MiB
171          webm       audio only DASH audio  122k , vorbis@128k, 10.09MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, mp4a.4
0.2@128k (44100Hz), 11.85MiB
251          webm       audio only DASH audio  171k , opus @160k, 12.17MiB
160          mp4        256x144    DASH video  111k , avc1.4d400c, 30fps, video
only, 2.90MiB
278          webm       256x144    144p  114k , webm container, vp9, 30fps, vide
o only, 6.84MiB
242          webm       426x240    240p  238k , vp9, 30fps, video only, 9.78MiB
133          mp4        426x240    DASH video  282k , avc1.4d4015, 30fps, video
only, 9.05MiB
243          webm       640x360    360p  450k , vp9, 30fps, video only, 18.84MiB

134          mp4        640x360    DASH video  633k , avc1.4d401e, 30fps, video
only, 13.50MiB
244          webm       854x480    480p  817k , vp9, 30fps, video only, 32.78MiB

135          mp4        854x480    DASH video 1187k , avc1.4d401f, 30fps, video
only, 27.63MiB
247          webm       1280x720   720p 1631k , vp9, 30fps, video only, 70.08MiB

136          mp4        1280x720   DASH video 2412k , avc1.4d401f, 30fps, video
only, 53.40MiB
248          webm       1920x1080  1080p 2852k , vp9, 30fps, video only, 141.70M
iB
137          mp4        1920x1080  DASH video 4346k , avc1.640028, 30fps, video
only, 160.93MiB
271          webm       2560x1440  1440p 9196k , vp9, 30fps, video only, 439.18M
iB
264          mp4        2560x1440  DASH video 9930k , avc1.640032, 30fps, video
only, 432.36MiB
313          webm       3840x2160  2160p 21444k , vp9, 30fps, video only, 1.26Gi
B
266          mp4        3840x2160  DASH video 23231k , avc1.640033, 30fps, video
 only, 969.65MiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)
So obviously it works without the no cert parameter. I tried it without the no cert parameter and received that same error message in the command box. I also cleared the SSL state in Internet Options and still had no success.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

highend
Posts: 13316
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: AYTS - Another YouTube Script

Post by highend »

Small update, added the --no-check-certificate option to both command
line calls to youtube-dl.exe. Seems otherwise you can get an SSL error...

Code: Select all

/*
******************************************************************************
@Changelog:
v0.2
 • Fixed: --no-check-certificate command line options added

******************************************************************************
*/

One of my scripts helped you out? Please donate via Paypal

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

Re: AYTS - Another YouTube Script

Post by klownboy »

Thanks highend for your help. I went to a Google site as directed somewhere in my research and downloaded / installed the latest Google certification [GIAG2.crt].
I ran certmgr.msc deleted an expired certification. In the end I think it may have been the expired cert that caused the problem. From what I read, it looks like youtube-dl looks at certs and if it sees an expired one it fails. So in the end I'm not so sure it's necessary, or possibly wise, to add the no cert parameter at least not because of me because it is working now. :) Thanks.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

highend
Posts: 13316
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: AYTS - Another YouTube Script

Post by highend »

I don't think that it causes real harm to leave it in (and it protects from expired certificates problems).
One of my scripts helped you out? Please donate via Paypal

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

Re: AYTS - Another YouTube Script

Post by klownboy »

highend wrote:I don't think that it causes real harm to leave it in (and it protects from expired certificates problems).
What I've read backs up that statement. Thanks again.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

highend
Posts: 13316
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: AYTS - Another YouTube Script

Post by highend »

A minimal update, if you were already happy with the script you don't need to download the new version...

Code: Select all

/*
******************************************************************************
@Changelog:
v0.3
  * Changed: Added a few more status messages for what is currently happening
  + New: Better handling of selecting multiple items in the meta data window,
         only the first selected one will now be used
******************************************************************************
*/

One of my scripts helped you out? Please donate via Paypal

Post Reply