Need help modifying a script

25 Antworten [Letzter Beitrag]
GNUser
Offline
Beigetreten: 07/17/2013

Hey guys.
So, I am trying to modify a script to download youtube videos.
I want to have a bash script, and couldn't find anything already done on the web, so I looked around and found this: https://calomel.org/youtube_wget.html
They use Perl, but I want to use bash (besides Perl is freaking weird to me, never learned to work with it). Basically I need only to learn how to look through the html of a youtube video page, and get the video url to download.

If someone can help me I would be really grateful, as I don't understand most of the code on that script.

The final result will be a simple bash script that downloads either a video or a full playlist from youtube, without using any SaSS and using Tor to protect and maintain privacy.

Thanks!!

GNUser
Offline
Beigetreten: 07/17/2013

problem with youtube-dl is the lack of support for Tor.
I have been working to make this script to be only bash, some basic sed/grep/cut/whatever and curl (which has Tor support).
I know it is not "simple" but thought that maybe someone could give me pointers on the link I provided as "this part here would look like this in bash" or "this is the way you have to look for this variable here".
youtube-dl is a bigger program and harder to understand since it has too much code.

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

Is 'youtube-dl --external-downloader curl' (maybe with --external-downloader-args too) a solution?

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

Is 'youtube-dl --external-downloader curl' (maybe with
--external-downloader-args too) a solution?

Mangy Dog

I am a member!

I am a translator!

Offline
Beigetreten: 03/15/2015

GNUser
your first post & last sentence indicates that you wish to download while using TOR

This will reveal your non-Tor IP address and de-anonymize you
https://www.torproject.org/download/download.html.en#Warning

+you also slow down the entire Tor network for everyone else.

onpon4
Offline
Beigetreten: 05/30/2012

Where do you get the idea that downloading something will reveal your IP address from that? It's not very nice for the network, but if the program is properly configured, there's no particular danger.

Mangy Dog

I am a member!

I am a translator!

Offline
Beigetreten: 03/15/2015

Tor is not aimed at downloading videos from youtube!
and even less for Torrents

Even for PDF it is not recommended by the
https://www.torproject.org/download/download.html.en#Warning

If you want to dowload use a VPN
Anonymity matters!
the respect of others too

SuperTramp83

I am a translator!

Offline
Beigetreten: 10/31/2014

That is correct, about torrenting over Tor - it **will** reveal punctually and always your real IP address. Consider though, as Onpon said, that if you configure properly **any** application which support the use of tor, then you can download and stay safe. Also, downloading PDFs and Docs over Tor is perfectly safe. What is not safe is **opening** said files for they may contain parts which phone home thus revealing your IP. So, what you want to do is: download the pdf, turn of your internet connection and only then open the pdf.
ciao mangy :)

onpon4
Offline
Beigetreten: 05/30/2012

BitTorrent is a special case because of the way the protocol works and the way BitTorrent clients behave. You can't generalize all downloading based on what they say about BitTorrent.

PDFs and other documents are also a special case. There isn't anything in video formats that can specify an external resource to load, so none of their comments about opening documents while connected to the Internet apply to video files.

vita_cell
Offline
Beigetreten: 07/19/2015

Hi, can you make some example command for download a video from youtube? and save it to .webm.

I always download with DownThemAll plugin.

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

I use ViewTube, a GreaseMonket script: http://isebaro.com/viewtube/

ViewTube let you choose what format/quality to play/download.

WEBM only is available at low quality on YouTube. If you want high quality, you will have to choose the MP4 format. You can then transcode to WEBM with an application such as Transmageddon, which is in Trisquel's repository. You would lose some quality though.

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

I use ViewTube, a GreaseMonket script: http://isebaro.com/viewtube/

ViewTube let you choose what format/quality to play/download.

WEBM only is available at low quality on YouTube. If you want high quality,
you will have to choose the MP4 format. You can then transcode to WEBM with
an application such as Transmageddon, which is in Trisquel's repository. You
would lose some quality though.

GNUser
Offline
Beigetreten: 07/17/2013

Hey guys.
So, I am trying to modify a script to download youtube videos.
I want to have a bash script, and couldn't find anything already done on the
web, so I looked around and found this: https://calomel.org/youtube_wget.html
They use Perl, but I want to use bash (besides Perl is freaking weird to me,
never learned to work with it). Basically I need only to learn how to look
through the html of a youtube video page, and get the video url to download.

If someone can help me I would be really grateful, as I don't understand most
of the code on that script.

The final result will be a simple bash script that downloads either a video
or a full playlist from youtube, without using any SaSS and using Tor to
protect and maintain privacy.

Thanks!!

SuperTramp83

I am a translator!

Offline
Beigetreten: 10/31/2014

That is correct, about torrenting over Tor - it **will** reveal punctually
and always your real IP address. Consider though, as Onpon said, that if you
configure properly **any** application which support the use of tor, then you
can download and stay safe. Also, downloading PDFs and Docs over Tor is
perfectly safe. What is not safe is **opening** said files for they may
contain parts which phone home thus revealing your IP. So, what you want to
do is: download the pdf, turn of your internet connection and only then open
the pdf.
ciao mangy :)

onpon4
Offline
Beigetreten: 05/30/2012

BitTorrent is a special case because of the way the protocol works and the
way BitTorrent clients behave. You can't generalize all downloading based on
what they say about BitTorrent.

PDFs and other documents are also a special case. There isn't anything in
video formats that can specify an external resource to load, so none of their
comments about opening documents while connected to the Internet apply to
video files.

vita_cell
Offline
Beigetreten: 07/19/2015

Hi, can you make some example command for download a video from youtube? and
save it to .webm.

I always download with DownThemAll plugin.

Mangy Dog

I am a member!

I am a translator!

Offline
Beigetreten: 03/15/2015

Tor is not aimed at downloading videos from youtube!
and even less for Torrents

Even for PDF it is not recommended by the
https://www.torproject.org/download/download.html.en#Warning

If you want to dowload use a VPN
Anonimity matters!
the respect of others too

onpon4
Offline
Beigetreten: 05/30/2012

Where do you get the idea that downloading something will reveal your IP
address from that? It's not very nice for the network, but if the program is
properly configured, there's no particular danger.

Mangy Dog

I am a member!

I am a translator!

Offline
Beigetreten: 03/15/2015

Darn then i've been ""over precautious"" :)
You see i always seen that as a potential risk

Thanks Opon4 & SuperTramp83 :-)

jbar
Offline
Beigetreten: 01/22/2011

GNUser: "They use Perl, but I want to use bash (besides Perl is freaking weird to me, never learned to work with it). Basically I need only to learn how to look through the html of a youtube video page, and get the video url to download."

Remember that bash is not a general purpose language. I'm not skilled in bash, but I'm sure that parsing html is much easier in languages like perl or python.

GNUser
Offline
Beigetreten: 07/17/2013

Hey guys.
Tried Magic Banana's method of "youtube-dl --external-downloader" but it doesn't work. I suppose youtube-dl still makes it own connection to DNS server, and my firewall is rejecting non-torified access (which is not a bug, I actually set it like that to prevent leaks).

So, yeah, I am still at square one. I would like to get someone to help with the script part, I am sure they have some parts where they locate a certain string and do some cut/sed/etc and end up with a link that can be used in "curl -L" with the socks proxy connection. Which is safe enough by the way, have tested it many times and other people have made some tests too.

I will give it another try at understanding something on their code, but hope you guys will help me out :)

GNUser
Offline
Beigetreten: 07/17/2013

problem with youtube-dl is the lack of support for Tor.
I have been working to make this script to be only bash, some basic
sed/grep/cut/whatever and curl (which has Tor support).
I know it is not "simple" but thought that maybe someone could give me
pointers on the link I provided as "this part here would look like this in
bash" or "this is the way you have to look for this variable here".
youtube-dl is a bigger program and harder to understand since it has too much
code.

Mangy Dog

I am a member!

I am a translator!

Offline
Beigetreten: 03/15/2015

GNUser
your first post & last sentence indicates that you wish to download while
using TOR

This will reveal your non-Tor IP address and de-anonymize you
https://www.torproject.org/download/download.html.en#Warning

Mangy Dog

I am a member!

I am a translator!

Offline
Beigetreten: 03/15/2015

Darn then i've been ""over precautious"" :)
You see i always seen that as a potential risk

Thanks Opon4 & SuperTramp83 :-)

jbar
Offline
Beigetreten: 01/22/2011

weird to me, never learned to work with it). Basically I need only to learn
how to look through the html of a youtube video page, and get the video url
to download."

Remember that bash is not a general purpose language. I'm not skilled in
bash, but I'm sure that parsing html is much easier in languages like perl or
python.

GNUser
Offline
Beigetreten: 07/17/2013

Hey guys.
Tried Magic Banana's method of "youtube-dl --external-downloader" but it
doesn't work. I suppose youtube-dl still makes it own connection to DNS
server, and my firewall is rejecting non-torified access (which is not a bug,
I actually set it like that to prevent leaks).

So, yeah, I am still at square one. I would like to get someone to help with
the script part, I am sure they have some parts where they locate a certain
string and do some cut/sed/etc and end up with a link that can be used in
"curl -L" with the socks proxy connection. Which is safe enough by the way,
have tested it many times and other people have made some tests too.

I will give it another try at understanding something on their code, but hope
you guys will help me out :)