On Sunday, 30. September 2012. 16.13.40 jdow wrote:
On 2012/09/30 11:44, Fernando Cassia wrote:
> On Sun, Sep 30, 2012 at 7:53 AM, Hiisi <hiisi(a)fedoraproject.org
> <mailto:hiisi@fedoraproject.org>> wrote:
> You don't need any script at all. Just copy the appropriate video file
> from /tmp folder when video is watched. That always worked for me.
>
> You´re surely not implying that manually going into the browser´s cache
> directory, finding the right file via its cryptic name and copying such
> file to the desired location plus renaming it to something meaningful has
> the same ease of use of ´youtube-dl -t [url]´
> and having the file saved with the right video title as per youtube
> description.
"ls -rt /tmp" doesn't show the file as the last one or one of the last
ones
present in /tmp?
Ok, folks, look, the file-in-/tmp method doesn't work for some time now, since
the flash plugin used to delete the file as soon as it was created (and before
any data has been copied into it). The way to go then is to grep the output of
ps to find the PID of the flash plugin, then go into the /proc/PID/fd, dig out
the file descriptor of the deleted file containing the video, then copy it
somewhere else. That's what the script does, or at least used to do.
However, in the most recent incarnation, the flash plugin doesn't even create a
file, but streams the media through a pipe from the net (yes, the video gets
downloaded again and again even on subsequent replay's, just watch the network
traffic while hitting the replay button over and over). The video doesn't get
written on the disk anywhere, AFAICT, just cached in memory in portions.
Furthermore, the streaming of the data requires a key-based authentication on
the YouTube server. The key is of course downloaded as a file and immediately
deleted once the flash plugin has it opened.
So now one needs to dig into the /proc/PID/fd to find file descriptors
containing the key, and then use those to authenticate against the YouTube
server and capture the incoming stream from the pipe (also present in
/proc/PID/fd). That's what the new script does, I guess.
So I definitely prefer to do a "youtube-dl -t <movie-url>" than to go
through
all those hoops manually. Besides, I often download whole playlists of stuff
from YouTube, so youtube-dl comes handy when downloading needs to be scripted.
GUI's don't offer such functionality, AFAIK...
Btw, I really don't get those flash plugin designers/programmers/whatever...
Why do they even bother to go through all that complications of "securing" the
video from being copied? It is completely obvious that any data which can be
displayed on the monitor, can also be redirected to a disk instead. There is
conceptually no way around that, so why complicate the protocol beyond any
sanity, only to have videos downloaded by a slightly more complicated python
script? I never understood that...
Best, :-)
Marko