5

I have YouTube link "https://www.youtube.com/watch?v=ySuYTKkgIvg"

How can I store this video from YouTube to my SD card?

I can play video using YouTube player by android YouTube DATA API but don't know how to download it is any API / code who can help me to do this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 1
    http://stackoverflow.com/a/9497608 – Sree Apr 02 '14 at 09:06
  • https://www.youtube.com/watch?v=ySuYTKkgIvg this link can be use for downloading in code which u refer me though ur link @Sreekanthss ur code shows how to dowload my problem is i dont know how to get that streaming link from above mentioned link – Android is everything for me Apr 02 '14 at 09:16

2 Answers2

1

Youtube API allows you to search & list videos and obtain the mediaplayer URL, so that you can play videos within your web page.

Look here for downloading video from Youtube

Youtube Video Data API

Youtube Java Data API - Getting Started

It does not allow you to download the byte content of videos - because Google is protecting their own rights and the rights of the content creators.

Youtube Google API Terms of Service

Community
  • 1
  • 1
Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85
1

You can try using my library, youtube-dl-android, which lets you to easily extract video link from 1000+ sites including YouTube, Facebook, etc.

Step 1: Add jitpack repository to your project build file

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Step 2: Add the dependency

dependencies {
    implementation 'com.github.bawaviki.youtube-dl-android:library:0.7.+'
}

Step 3: Use Youtube-dl instance

YoutubeDLRequest request = new YoutubeDLRequest("http://youtube.com/watch?v=xxxx");
request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%(ext)s");
YoutubeDL.getInstance().execute(request, (progress, etaInSeconds) -> {
    System.out.println(String.valueOf(progress) + "% (ETA " + String.valueOf(etaInSeconds) + " seconds)");
});
M--
  • 25,431
  • 8
  • 61
  • 93
bawaviki
  • 21
  • 3