Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

youtube-dl in Android [duplicate]

I am trying to retrieve a videoplayback URL from a YouTube link. I know this can be done with youtube-dl (youtube-dl --get-url http://www.youtube.com/watch?v=VIDEO_ID).

youtube-dl is written in Python and I know that it is somehow possible to bridge between Python and Java using Jython or Python-for-Android Py4A. But my question is how am I going to achieve this? Is there some relatively easy way to bridge between these two languages like it is between C and Java through JNI?

like image 474
sn0ep Avatar asked Feb 19 '14 00:02

sn0ep


People also ask

Is YT-DLP safe?

2 Answers. yt-dlp appears reasonably safe (hence the >7K stars on Github). It is a fork of youtube-dlc (now also a dead project) which was a fork of youtube-dl . As you can probably tell, it is much more active in terms of development and has many extra features such as better extractors and other options.

Where are youtube-dl downloads stored?

On Windows, the user wide configuration file locations are %APPDATA%\youtube-dl\config. txt or C:\Users\<user name>\youtube-dl.


1 Answers

Python can be called from within many popular programming languages. Here is how I would do it in java.

Process py = Runtime.getRuntime().exec("youtube-dl.py");

Another good option is Jython. It is a library for Java that may give you a little more control over what you are doing. Good for if you do plan on making it a whole application as opposed to a small script.

This source shows three ways of executing python code in java

EDIT: Realized you noted Jython in your question but I will leave the source in for others.

like image 196
King Popsicle Avatar answered Sep 19 '22 15:09

King Popsicle