Giter Site home page Giter Site logo

ytfs's Introduction

http://i.imgur.com/Wbss2gh.png


YTFS - File system which enables you to search and play movies from YouTube as files - with tools of your choice. Based on FUSE, written in Python 3.

Dependencies, manual and documentation: Read the Docs

Installation

You can install YTFS with pip:

$ pip3 install ytfs

You need Python 3.4 or newer.

Important

Only systems where FUSE lib (or compatible) is available are supported. YTFS was tested on Linux, OS X and FreeBSD.

Usage

Here some basics are shown. See documentation for more detailed description.

Mount

Mount YTFS in an empty directory, for example:

$ mkdir youtube
$ ytfs youtube

Search

Enter the directory where YTFS is mounted and create a directory whose name is your search query. You can use GUI or CLI (note that the latter is most stable). If you like command line:

$ cd youtube
$ mkdir "rick astley"

Search results will appear in the directory you have created.

You can narrow your search to a specific channel:

$ mkdir "foo bar baz channel:foochannel"

Other additional parameters like before:, after: or max: are available. See docs for details.

To navigate between search pages use next and prev scripts in the search directory. Note that they have a space character at the beginning, thereby in most shells/file managers they should be alphabetically first:

$ ./\ next
$ ./\ prev

Playback

You can use search results as regular files. Open them with your favourite player, for example:

$ mkdir "rick astley"
$ cd rick\ astley
$ mplayer "Rick Astley - Never Gonna Give You Up.mp4"

Or you can copy them on your hard drive:

$ cp "Rick Astley - Never Gonna Give You Up.mp4" ~/youtube-collection/

Unmounting

To unmount, use fusermount -u and specify the directory where YTFS was mounted:

$ fusermount -u youtube

Dependencies

If you mount YTFS with options to download full videos at heighest quality, then audio and video merging may be needed. In such case FFmpeg or Libav is required.

Contribute!

If you want to suggest a new feature or help with development in any way, please open an issue or contact me via email.

License

MIT (c) Adrian Włosiak

ytfs's People

Contributors

arlol avatar ckorn avatar danieledapo avatar horb avatar jeltef avatar rasguanabana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ytfs's Issues

can't do anything with the files. 'bad address'

I tried to save a vid, with the command

cp vid /tmp

Got this: cp: cannot open ‘morality.mp4’ for reading: Bad address
Also the mplayer example won't work, and the the vlc player also tells me filesystem access error: cannot open file /tmp/ytfs/something/somethig (Bad address) .

Also when mounting the system, I got this message, but creating directories seemed to work ok: 'fusermount: failed to open /etc/fuse.conf: Permission denied'.

I have some strace output, i think the relevant one is here:

stat("the_file.mp4", {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
stat("/tmp/the_file.mp4", 0x7ffdbc0d0de0) = -1 ENOENT (No such file or directory)
open("the_file.mp4", O_RDONLY) = -1 EFAULT (Bad address)

So if you need any more info from me, I'll happily provide it. In the meantime I might take a look for myself, and I'll post here if I find something.

I can't use any of the search results

This is my error message when I try to copy it, (in english it would be "can't open for reading, invalid address")

cp Rick\ Astley\ -\ Never\ Gonna\ Give\ You\ Up\ \[HQ\].mp4 ..
cp: 'Rick Astley - Never Gonna Give You Up [HQ].mp4' kann nicht zum Lesen geöffnet werden: Ungültige Adresse

Also playing with mplayer doesn't work.

I am runnig on Arch Linux.

Mount point doesn't show over SMB share.

The folder in which the ytfs mount is located doesn't even show up in a samba share.

Symlinks to the folder also don't show up.


edit:

Problem seems to be fixed by changing:
FUSE(YTFS(), x.mountpoint[0], foreground=x.d)
to
FUSE(YTFS(), x.mountpoint[0], foreground=x.d, allow_other=True)

I also had to add "user_allow_other" to /etc/fuse.conf.

Fix streaming

Current approach leads to downloading whole data at once

Channel: searching

Windows forbids the characters \ / : * ? " < > | from appearing in folder/file names.

So searching by "channel:channel_name" will not work. Can you provide a switch for a different delimiter?

Content unplayable with default options

Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/fuse.py", line 414, in _wrapper
    return func(*args, **kwargs) or 0
  File "/usr/lib64/python3.4/site-packages/fuse.py", line 483, in open
    fi.flags)
  File "/usr/lib64/python3.4/site-packages/fuse.py", line 709, in __call__
    return getattr(self, op)(*args)
  File "/usr/lib64/python3.4/site-packages/ytfs/ytfs.py", line 326, in mod
    return method(self, self.__pathToTuple(path), *args)
  File "/usr/lib64/python3.4/site-packages/ytfs/ytfs.py", line 569, in open
    if yts.obtainInfo(): #FIXME coz it's ugly.
  File "/usr/lib64/python3.4/site-packages/ytfs/stor.py", line 222, in obtainInfo
    full= {(-int(f['height']), f['filesize'], f['url']) for f in info['formats'] if 'DASH' not in f['format']}
  File "/usr/lib64/python3.4/site-packages/ytfs/stor.py", line 222, in <setcomp>
    full= {(-int(f['height']), f['filesize'], f['url']) for f in info['formats'] if 'DASH' not in f['format']}
KeyError: 'height'

It seems to be a bad idea to rely on info provided by youtube-dl as it happens to be inconsistent.

Traceback fusermount operation not permitted

> ytfs -v yt
fusermount: mount failed: Operation not permitted
Traceback (most recent call last):
  File "/nix/store/msgclqxm75hm9qnjh852bc55psjs34pb-python3.4-ytfs-2015-7-7/bin/.ytfs-wrapped", line 618, in <module>
    main(x.mountpoint[0], av)
  File "/nix/store/msgclqxm75hm9qnjh852bc55psjs34pb-python3.4-ytfs-2015-7-7/bin/.ytfs-wrapped", line 601, in main
    FUSE(YTFS(av), mountpoint, foreground=False)
  File "/nix/store/xdj776snviig0lk3wmlk48dzqzhbn59x-python3.4-fusepy-2.0.2/lib/python3.4/site-packages/fuse.py", line 399, in __init__
    raise RuntimeError(err)
RuntimeError: 1

I tried sshfs, it runs fine.

Most popular

Is it possible to make search based on views without searching in channels? I don't know if youtube api has this possibility.

Thoughts on migrating from fusepy to easyfuse

Fusepy seems kind of dead, as it has not had any commits in three years, with quite some open issues and pull requests. https://github.com/terencehonles/fusepy
llfuse seems to be the new and maintained FUSE interface. https://pythonhosted.org/llfuse/
However, that is quite low level and requires quite some work for easy use. That is why I have created easyfuse, which is a new library building on top of that with a very simple interface. https://jeltef.github.io/easyfuse/dev/

I would like to check out what would be needed to migrate ytfs from fusepy to easyfuse. Is this something you are interested in as well?

Bad address

Trying to open a file, copy it, etc., the "bad address" error is displayed. Using ytfs installed using "pip3 install ytfs" in Ubuntu 16.04 (64bit).

Running ytfs in debug mode displays the following error:

$ ytfs -d youtube
Mounting YTFS ver. 0.99a4.
If you encounter any bugs, please open an issue on GitHub: https://github.com/rasguanabana/ytfs
Traceback (most recent call last):
  File "/home/andrei/.local/lib/python3.5/site-packages/fuse.py", line 495, in _wrapper
    return func(*args, **kwargs) or 0
  File "/home/andrei/.local/lib/python3.5/site-packages/fuse.py", line 572, in open
    fi.flags)
  File "/home/andrei/.local/lib/python3.5/site-packages/fuse.py", line 800, in __call__
    return getattr(self, op)(*args)
  File "/home/andrei/.local/lib/python3.5/site-packages/ytfs/ytfs.py", line 323, in mod
    return method(self, self.__pathToTuple(path), *args)
  File "/home/andrei/.local/lib/python3.5/site-packages/ytfs/ytfs.py", line 565, in open
    if yts.obtainInfo(): #FIXME coz it's ugly.
  File "/home/andrei/.local/lib/python3.5/site-packages/ytfs/stor.py", line 234, in obtainInfo
    if self.preferences['audio'] and self.preferences['video']: fm = sorted(full, key=_k)
TypeError: unorderable types: str() < int()

Can't install with setup.py because you're importing the whole thing in setup.py

I cloned the project, and hit python setup.py develop, when BAM, this.

Obviously, you're importing in setup.py the version which causes everything to get imported before actually installing the project, and therefore one would have to install all dependencies by hand prior to calling setup.py develop.

I found a nice answer on stack overflow on how to better specify the __version__ attribute
http://stackoverflow.com/questions/17583443/what-is-the-correct-way-to-share-package-version-with-setup-py-and-the-package

Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from ytfs import __version__
  File "/home/3pillar.corp/vlad.ardelean/tmp/clones/ytfs/ytfs/__init__.py", line 1, in <module>
    from .ytfs import __version__
  File "/home/3pillar.corp/vlad.ardelean/tmp/clones/ytfs/ytfs/ytfs.py", line 20, in <module>
    from fuse import FUSE, FuseOSError, Operations
ImportError: No module named 'fuse'

To lazy to submit a PR, but when you (or someone) get(s) to it, it should be a quick fix.

OS error occured

Hi. I installed ytfs with pip3 install. However it turns out that there is some error on my computer so I cannot run the source code.

ytfs_error1

After see this message, I just delete ytfs with pip uninstall and installed it with python setup.py install, but same error occurs. Is there any way to solve this problem?

Thanks.

WARNING: Unknown codec av1

I getting:

WARNING: Unknown codec av1

while I try:

mkdir youtube-3
ytfs -d youtube-3
Mounting YTFS ver. 0.99a5.
If you encounter any bugs, please open an issue on GitHub: https://github.com/rasguanabana/ytfs
WARNING: Unknown codec av1
cd youtube-3
mkdir "full hd test"
cd full hd test
vlc 1 Hour 1080p NVIDIA PureVideo HD 1080p Test.mp4

On:
YTFS ver. 0.99a5.
Python 3.6.5
Darwin 17.6.0
macOS 10.13.5 (17F77)

Feature Request: Youtube Uploading

It would be excellent if this FUSE lib supported uploading videos to Youtube as well. This can be supported via various means including Torkland's youtube_upload repository. It would also allow you implement overwriting and other features.

Using Youtube's DATA API would make this system much more flexible anyhow as you can edit additional data about the video and support better integration with the technology.

I am definitely willing to help implement this if you find this change acceptable.

YouTube Data API v3 Key is Unconfigured

In ytfs.YTActions.__search the self.api_keyis used to query the YouTube Data API v3.

The current API Key is un-configured. The request results in a 403 response;

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. YouTube Data API has not been used in project 711560230058 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=711560230058 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=711560230058"
   }
  ],
  "code": 403,
  "message": "Access Not Configured. YouTube Data API has not been used in project 711560230058 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=711560230058 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
 }
}

I see two options;

  • Configure the API Key and hope for the best in future.
  • Allow the API Key to be configurable.

Add syntax for channels/users

It would be great to add folders for specific youtubers. That way, I can just have my list of users I subscribe to in directory format. Perhaps having similar syntax to google's site:example.com syntax?

larry@localhost /tmp/ytfs $ mkdir user:zisteau

Feature Request: Playlist Support

It would be great if we could create a playlist folder in ytfs that would display the contents of a YouTube playlist similar to the way channel folders work. Maybe something like: "playlist:"

Make *simple* format selection

Now it uses unpredictable youtube-dl format, which isn't very user friendly. Use -a (bestaudio), -v (bestvideo) and -av (best) to provide streamable defaults (unless -S option is selected, then -av will select bestvideo+bestaudio for merge).

Always choose bestaudio for audio only (do we need audio format selection?)

For video, let user specify height and then choose the nearest format. Prefer streamable ones, but if -av is specified and user chose high quality (e.g. 1080), then use DASH formats.

Also, make -av default instead of -a alone.

TypeError: '<' not supported between instances of 'int' and 'str'

getting this while searching, using Python 3.6.0:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/fuse.py", line 495, in _wrapper
    return func(*args, **kwargs) or 0
  File "/usr/local/lib/python3.6/site-packages/fuse.py", line 572, in open
    fi.flags)
  File "/usr/local/lib/python3.6/site-packages/fuse.py", line 800, in __call__
    return getattr(self, op)(*args)
  File "/usr/local/lib/python3.6/site-packages/ytfs/ytfs.py", line 323, in mod
    return method(self, self.__pathToTuple(path), *args)
  File "/usr/local/lib/python3.6/site-packages/ytfs/ytfs.py", line 565, in open
    if yts.obtainInfo(): #FIXME coz it's ugly.
  File "/usr/local/lib/python3.6/site-packages/ytfs/stor.py", line 235, in obtainInfo
    elif self.preferences['audio']: fm = sorted(aud, key=_k)
TypeError: '<' not supported between instances of 'int' and 'str'

Description in .txt files

I don't know the YouTube API or youtube-dl at all, but would it be possible to have beside the .mp4 files .txt files with the video description? Sometimes it's really useful to read them as they contain important info, links, lyrics, etc...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.