rasguanabana / ytfs

YouTube File System
MIT License
1.1k stars 45 forks source link

Feature Request: Youtube Uploading #12

Open Skylion007 opened 9 years ago

Skylion007 commented 9 years ago

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.

rasguanabana commented 9 years ago

Thank you for your suggestions. I think it's still much more convenient to use a separate program for uploading, but it can be implemented in ytfs, using a special directory or something similar. It can be tricky to set descriptions, titles and some other settings, though. Finding an intuitive way to do this may be somewhat hard.

Anyway, in order to implement that feature (as well as some other things, e.g. managing playlists and subscriptions), authentication needs to be done.

Seems like it's time to get back to work after some inactivity :)

Skylion007 commented 9 years ago

I don't know how you want to do it, but the way Youtube stores that data is via JSON files (at least when I download all my Youtube data from Google's Export feature. You can store all the necessary data in those JSON files for any files which you own, modifying any of those files would then cause the change to propagate to the corresponding video files.

I don't know how Youtube stores playlists, since I've never created one but you can find out using the aforementioned Youtube Takeout feature.

Hopes this helps!

Edit: Also, if you use the GDATA API, authentication is handled via OAUTH. You can even easily make a GUI component that allows the user to login using QTWebkit via PyQt4 or Pyside.

Another advantage of using the GDATA Api is that you can drop the Youtube-dl dependency, I believe.

rasguanabana commented 9 years ago

How data is kept on server is rather irrelevant, the problem I see is how to provide convenient and usable interface for providing video information, being limited to filesystem operations. It is pretty doable, but the effect may be hardly user-friendly. That's my biggest concern.

Managing playlists is not hard, that's all you need: https://developers.google.com/youtube/v3/docs/playlists It's just I need to find some free time to implement auth :)

Oh, and dropping youtube-dl dependency isn't that straight-forward, API won't let you to get direct URLs to video content and it's the only thing I need youtube-dl for.

Skylion007 commented 9 years ago

I agree. Either have a companion file or could you possibly have a method of determining the data from the video's metadata? That might be a little too hacky, but it could work.

Perhaps you could not upload the file until the XML metadata for the corresponding data has been created. Additionally, you could display a prompt to have the user enter the data. If you follow the later case, I'd recommend using PyQT4, PySide, or both as they are pretty generic UIs that work cross-platform with Python.

I definitely see your issue. The metadata stuff might be the easiest way to do it from a filesystem operation point of view, even if it is a little non-intuitive.

You could even do a combination of the two techniques where it prompts the user if the metadata is nonexistent.

Furthermore, you could have two folders. One for 'uploaded' content and for 'uploading' content since it can be difficult to edit certain parts of the video.

This is definitely an interesting, and fascinating design challenge. If you are looking for how to implement auth, I think the --auth-browser option on youtube_upload does an excellent job and it leverages the aforementioned QTframework. You can also have it drop back to the console method they use if all else fails. That is a great place to look for an example of authentication that actually works on Python 3 since Google's API examples are sometimes lacking in this regard.

beigexperience commented 8 years ago

youtube-dl can store the description in a plaintext .description file. It can also give you the JSON for a video with a switch. You can simply expose those files.