I want to play youtube video on Surface
, using MediaPlayer
.
So, I should put there direct video link.
Problem is: How to get this link on Android device?
Link like this: http://gdata.youtube.com/feeds/api/videos/VIDEO_ID
Is no longer available. Probably because of old and deprecated API v2.0.
But this web service somehow do the trick.
And result link works perfect. So it is still possible.
Asked
Active
Viewed 7,335 times
6

Volodymyr Kulyk
- 6,455
- 3
- 36
- 63
1 Answers
8
Try with this url
String ytInfoUrl="http://www.youtube.com/get_video_info?video_id=" + youtubeID + "&eurl="
+ URLEncoder.encode("https://youtube.googleapis.com/v/" + youtubeID, "UTF-8");
Open this using a HttpGet extract the RTSP urls from that info response.
edit
You can use this link for extracting the RTSP links https://github.com/flipstudio/YouTubeExtractor/blob/master/src/main/java/com/flipstudio/youtube/extractor/YouTubeExtractor.java
edit
A lot have been changed please use this project for proper extraction https://github.com/HaarigerHarald/android-youtubeExtractor/blob/master/youtubeExtractor/src/main/java/at/huber/youtubeExtractor/YouTubeExtractor.java

Sunil Sunny
- 3,949
- 4
- 23
- 53
-
1what is your initial request it should look something like this "http://www.youtube.com/get_video_info?video_id=SqhV4ouGdPE&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FSqhV4ouGdPE" – Sunil Sunny Jul 24 '15 at 12:56
-
Try that url on postman ..I am getting the response ..No errors – Sunil Sunny Jul 24 '15 at 12:59
-
Yes, i've got this request. Thinking on "extracting" RTSP url. – Volodymyr Kulyk Jul 24 '15 at 12:59
-
3did you extracted the RTSP urls .If not try this link also https://github.com/flipstudio/YouTubeExtractor/blob/master/src/main/java/com/flipstudio/youtube/extractor/YouTubeExtractor.java – Sunil Sunny Jul 24 '15 at 13:20
-
how did u manage to extract the RTSP URL from that response.how did you do the parsing? – Parth Doshi Sep 11 '16 at 13:18
-
1@ParthDoshi split the response and search for "url_encoded_fmt_stream_map" – Sunil Sunny Sep 19 '16 at 05:51
-
1Thanks man, i have used this class: https://github.com/flipstudio/YouTubeExtractor/blob/master/src/main/java/com/flipstudio/youtube/extractor/YouTubeExtractor.java You saved my day :D – Ali Noureddine Oct 19 '16 at 20:38
-
How to use above YoutubeExtractor mentioned above. What arguments I have to pass for extracting , VideoId or url obtained from above mentioned url. – baldraider Dec 15 '16 at 07:30
-
1@Sushantkumar You have to extract videoId by yourself. There are plenty of ways to do it just search in stack. – Sunil Sunny Dec 15 '16 at 18:23
-
@sunilsunny this yoututbe extractor not working with all video Id – baldraider Jan 05 '17 at 11:46
-
@Sushantkumar Yes some of the id's are not supported .This links need to deciphered to get the RTSP link. – Sunil Sunny Jan 06 '17 at 05:39
-
2Thanks a lot @sunilsunny. I'd been cracking my head over this and only getting answers to use deprecated google data apis. Thank god this solution exists. :) – vepzfe Mar 23 '17 at 09:16
-
@sunilsunny even though onSuccess been called, all the URIs i get are null. why is that? – SUXA Jun 10 '17 at 13:31
-
@sunilsunny. It's working. Is this project is safe and free to use? – SUXA Jun 30 '17 at 10:22
-
@SUXA It's free and safe to use for sure, but we are extracting the RTSP urls through backdoor which might be aganist the Yotube policies.. – Sunil Sunny Jun 30 '17 at 11:10