Direct Youtube video downloader

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Direct Youtube video downloader

Post by RSBasic »

Hello

There are many addons and pages to download YouTube video. There you either have to click on the download button or enter and confirm the URL.
I had an idea and I can offer a service to download YouTube videos directly automated without GUI and without user input.

You can download any YouTube video with my site instantly. Just call my address with the parameter VideoID and the download will start immediately.
I am using the following code to download YouTube videos: https://github.com/Athlon1600/youtube-downloader
I have extended the code so that you can download any YouTube video directly via URL.
You can download any video as mp4 720p. Other formats and qualities are not planned.

You can use my site both privately and for your projects.

Automated download link: http://youtube.rsbasic.de/?v=<ID>
Example: http://youtube.rsbasic.de/?v=viaRIIMsMZA
PB example:

Code: Select all

EnableExplicit

InitNetwork()

ReceiveHTTPFile("http://youtube.rsbasic.de/?v=viaRIIMsMZA", "D:\MyVideo.mp4")
Have fun :)
Image
Image
User avatar
ar-s
Enthusiast
Enthusiast
Posts: 340
Joined: Sat Oct 06, 2007 11:20 pm
Location: France

Re: Direct Youtube video downloader

Post by ar-s »

Cool tool :D
Thanks :mrgreen:
~Ar-S~
My Image Hoster for PB users
My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 3.x / 5.7x / 6 - W11 x64 - Ryzen 7 3700x / #Rpi4

Code: Select all

r3p347 : 7ry : un71l d0n3 = 1
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1252
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: Direct Youtube video downloader

Post by Paul »

It would be interesting to see how you have it all set up in case one wanted to set up their own download server.
Image Image
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: Direct Youtube video downloader

Post by SPH »

Very interesting. well done
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Direct Youtube video downloader

Post by applePi »

.
Last edited by applePi on Wed Sep 18, 2019 5:07 am, edited 1 time in total.
Rinzwind
Enthusiast
Enthusiast
Posts: 638
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Direct Youtube video downloader

Post by Rinzwind »

You do know that sooner or later bandwidth will go through the roof? You're prepared for that?

Or YouTube start blocking your ip(rang).

Anyway, interesting to see what going on behind the scenes. Seems like an interesting github project so others can also mirror it. Possibly using https://github.com/ytdl-org/youtube-dl/ ?
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: Direct Youtube video downloader

Post by SPH »

Hi, I'm interested in this subject. Let's take a concrete youtube example:
https://www.youtube.com/watch?v=RYAIQRPPu5w

How to download it?
Is it up to us to impose conversion to MP4 or must we know in advance in which format the video is?

Thank you :!:
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Direct Youtube video downloader

Post by RSBasic »

SPH wrote:Is it up to us to impose conversion to MP4 or must we know in advance in which format the video is?
No, YouTube automatically converts the uploaded videos to MP4 using codec H.264.
SPH wrote:How to download it?
Simply copy and paste the VideoID:
https://www.youtube.com/watch?v=[b]RYAIQRPPu5w[/b]
http://youtube.rsbasic.de/?v=[b]RYAIQRPPu5w[/b]
Downloadlink from your video: http://youtube.rsbasic.de/?v=RYAIQRPPu5w
Paul wrote:It would be interesting to see how you have it all set up in case one wanted to set up their own download server.
1. I downloaded the GitHub code "youtube-downloader" and uploaded it to my server.
2. I wrote a PHP file to receive the parameter for the VideoID and pass it to the function of "youtube-downloader".
3. I get the download link from the "youtube-downloader" function. I send the download link to the header of my PHP page and the file is offered for download.
4. I created a subdomain.
Rinzwind wrote:You do know that sooner or later bandwidth will go through the roof? You're prepared for that?
The mp4 file is downloaded from the original YouTube server. My server is not affected by this.
Rinzwind wrote:Or YouTube start blocking your ip(rang).
There are many pages and addons that do the same. YouTube doesn't seem to have a problem with that. :D
Image
Image
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: Direct Youtube video downloader

Post by SPH »

Thank you very much.

Small question: Is there a quota not to exceed a day?
Because, I tried to transform this:
https://www.youtube.com/watch?v=uF0PrDdKogo

in this:
http://youtube.rsbasic.de/?v=uF0PrDdKogo

but it does not work. Why ?

Thank you :|
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Direct Youtube video downloader

Post by RSBasic »

I've noticed that, too. It doesn't work on all videos. This problem exists with all other pages and addons too.
My guess is: YouTube has many servers (load balancer) and some servers do not support the download.
But other quality levels (720p, 480p, 360p) may work. I'll test and check that.
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Direct Youtube video downloader

Post by RSBasic »

I've analyzed it. I get the following array from youtube-downloader function:

Code: Select all

array(1) { [18]=> array(2) { ["url"]=> string(793) "https://r1---sn-oxujvavbox-jbol.googlevideo.com/videoplayback?expire=1569074820&ei=JNqFXZPJEJGt1wLxmLzoCA&ip=2a00%3A17d8%3A200%3A%3Ad1&id=o-APPUaPDxtm5WunaCMh7uMPSZYH95rUleEB7O8jK4fGev&itag=18&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-oxujvavbox-jbol%2Csn-5hnekn7k&ms=au%2Crdu&mv=u&mvi=0&pl=32&mime=video%2Fmp4&gir=yes&clen=367765293&ratebypass=yes&dur=5020.107&lmt=1540385078883928&mt=1569052721&fvip=4&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AHylml4wRAIgb8Yj7tGC1hJ9odja-y6GnjT_LbmnJ6HZrDqi-s9129sCIHbm7NO1nzZ3BmMAdsVtiS2gTmlrodYllq1SDKPGw7b9&signature=X==QoKcfVpHe6rjDeI8HKVZkObiFzj40LttwYBZg4keruGDQICkSW8RVcI8FUjRZVwZ=1nW-Hw8LXYCwyKFHtc0dAKbVUgIQRww2IxgLAgLA" ["format"]=> string(8) "MP4 360p" } } 
Download is not possible with this URL from this Google server. Sorry, I can't fix the problem.
Image
Image
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Direct Youtube video downloader

Post by Mijikai »

Nice project, the last time i tried to write a downloader i was only able to download video (*.webm) and sound seperately.
I still have the project (i was brutefocing the data container until it contained valid video links).
firace
Addict
Addict
Posts: 903
Joined: Wed Nov 09, 2011 8:58 am

Re: Direct Youtube video downloader

Post by firace »

http://youtube.rsbasic.de/?v=uF0PrDdKogo

but it does not work. Why ?

Thank you :|
FWIW youtube-dl seems to have no problem with it:

Code: Select all

youtube-dl.exe https://www.youtube.com/watch?v=uF0PrDdKogo
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Direct Youtube video downloader

Post by Derren »

Looks like this video was migrated from googlevideo, which is no longer active, but it seems they kept the servers running and only built a bridge interface to youtube.
The author of the lib RSBasic is using probably didn't account for that
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: Direct Youtube video downloader

Post by SPH »

Derren wrote:Looks like this video was migrated from googlevideo, which is no longer active, but it seems they kept the servers running and only built a bridge interface to youtube.
The author of the lib RSBasic is using probably didn't account for that
Do you know a lib that can download any type of video youtube? :?:
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
Post Reply