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?
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.