
Show HN: YouTube Filesystem – YTFS - rasguanabana
https://github.com/rasguanabana/ytfs
======
andrewstuart2
Haha, from the title I expected this to be a solution for generating MP4s from
arbitrary data that you could then upload to YouTube for backup.

This is definitely really cool, too. I like that it shows that a node in a
filesystem is just another way to represent some resource, but in a way that's
a little more familiar to most people than something like procfs.

~~~
JoshTriplett
That's a fascinating idea. Unlike gmail, there isn't an upper bound on how
much you can store on YouTube. If you could encode data in a way that's
resilient against re-encoding, you could use YouTube for steganography as
well. Or, for that matter, see
[http://dataliberation.blogspot.com/2012/09/your-youtube-
orig...](http://dataliberation.blogspot.com/2012/09/your-youtube-original-
videos-now.html) .

That said, it's also amazingly wasteful, and abusing a free service for a
purpose it isn't intended for.

~~~
andrewstuart2
Definitely. And you'd have no guarantee that your video wouldn't get
transcoded someday into a format or setting that corrupts it.

~~~
Joona
Speaking of corruption, I found this[1] video a while back. On mobile the
video shows up fine, but on desktop it's just a gray screen, although the
thumbnails work.

[1]:
[https://www.youtube.com/watch?v=lOb8TNn7sDE](https://www.youtube.com/watch?v=lOb8TNn7sDE)

~~~
madez
The video is showing fine here. I'm using the HTML Video Everywhere!
extension.

~~~
a1369209993
I can confirm that the mp4 I downloaded is not (detectably by my desktop video
player) corrupt. I am not sure what it _is_ , but it is not corrupt. (Except
for the filename, but that is because javascript is brain-damaged as regards
strings.)

~~~
madez
I also have cookies and javascript disabled. Maybe the javascript is messing
with the video.

------
JoshTriplett
Interesting! Looks like this is youtube-dl combined with FUSE, so that you can
use a normal video player to play and filesystem tools to browse, rather than
downloading first. See
[https://github.com/rasguanabana/ytfs/blob/master/doc/depende...](https://github.com/rasguanabana/ytfs/blob/master/doc/dependencies.rst)
.

------
anukulrm
This is great! Also, check out this easter egg which makes every video rick
roll haha:
[https://github.com/rasguanabana/ytfs/blob/master/stor.py#L12...](https://github.com/rasguanabana/ytfs/blob/master/stor.py#L126)

------
fragmede
Neat! Any plans to make the different video qualities quickly available? Maybe
as a subdir named with the resolution, eg search/movie/480p.mp4 or maybe
movie.1080p.mp4?

~~~
rasguanabana
Oh, I don't want to clutter it too much, it's better to keep it simple.

It definitely needs a mount option to set the default quality. Changing it
later might be tricky, maybe passing options in directory names would be a
good idea? for example: mkdir "foobar [q:720p]"

~~~
omribahumi
How about doing it with mount options, so someone would mount
/mnt/youtube/hires /mnt/youtube/lowres with different options?

~~~
rasguanabana
That is going to be the first thing to implement now.

------
kalmi10
It seems not to support streaming. It has to download the whole video before
playing can begin.

~~~
rasguanabana
Some time ago Youtube started to provide audio and video separately. Due to
that, for full videos whole data needs to be downloaded before reading (it's
hard to merge them on-the-fly). For just audio or just video data streaming is
intended, but needs reimplementation.

~~~
agumonkey
Are you sure ? youtube-dl still gives link to plain old streamable mp4 (I
don't know much, I just use it half blindly).

~~~
CyberShadow
I think these monolithic files are provided only for up to 720p quality,
mainly for compatibility with older Flash players. To download the maximum
quality with youtube-dl, you have to use "-f bestvideo+bestaudio" \- then,
youtube-dl will download both streams, and merge them for you with an ffmpeg
invocation.

~~~
agumonkey
Ha, I never paid much attention to higher bitrates, and most of the time I
only see resolution up to 720p (maybe because of my tastes).

I'm sure there are ways to merge streams on the fly though.

~~~
daxelrod
There has to be some way, the player on the YouTube website does it. :)

------
fiatjaf
Are there any installations instructions? This seems to depend on a lot of
libraries that are not specified anywhere.

------
dfrey
The world would be a better place if we could run "rm -rf ./comments/*" on
YouTube.

~~~
TimJRobinson
Theres a chrome extension called alientube that shows reddit comments instead
(useful for finding obscure niche subreddits too). Or there's plenty of
extensions to hide comments.

~~~
tomswartz07
My favorite is 'Herp Derp for YouTube'.

It changes every comment to a mix of

> Derp herpy derp derp

while still allowing you to click and see the "quality" comment that the
person left.

[https://chrome.google.com/webstore/detail/herp-derp-for-
yout...](https://chrome.google.com/webstore/detail/herp-derp-for-
youtube/ioomnmgjblnnolpdgdhebainmfbipjoh)

------
0xdeadbeefbabe
The file system is a great UI that doesn't pretend to be a great UI. Thanks!

------
zeeed
kudos, that's an excellent idea, combining out-of-the box thinking, data
structuring, creating value all using basic tools. A tip to the hat. Nice
work!

------
rian
Might I recommend not using the prev/next executables and instead adding
another directory level to indicate search page, e.g. ytfs/search/1/video.mp4

would make it easy to reexport this file system, e.g. Over http or smb.

~~~
rasguanabana
I have to think that through. Search pages are tricky as you can't simply go
to a certain page. They're identified by tokens, which aren't known a priori -
you just get adjacent ones with search results.

A reasonable solution would be ability to set max results and disabling
next/prev. All desired results would show up in the search directory (if you
can assume that results beyond some point are useless).

~~~
mappu
I think the most obvious way to expose that remote behaviour in the filesystem
is to have the directory /search/2/ appear only after the directory /search/1/
has been stat'd.

------
walterbell
Does this use a persistent cookie which YouTube can use to personalize search
results?

~~~
rasguanabana
There's no authorisation at the moment. Plain requests.get is used.

------
agumonkey
side-note: I find it very very interesting to think about a filesystem of
unknown content and size. It's basically an infinite tree through FUSE.
Nothing crazy, but interacting with it directly is inspiring.

~~~
nitrogen
Back in the kernel 2.2 days there was an explosion of experimental
filesysyems, like ftpfs, cdfs/cdripping fs, and more. Now that we have
widespread FUSE bindings it seems we'll see a filesystem renaissance.

~~~
agumonkey
Right but ftp/cd are finite data sets. So far nobody has access to youtube
full index and the virtual fs has to generate/navigate on the fly. Imagine a
GoogleSearchFS, makes things a little different.

------
aikah
how is it a filesystem? can I store a PDF or zip file on youtube with that ?

~~~
rasguanabana
It's read-only - you can play/copy youtube movies as a file

