HaarigerHarald / android-youtubeExtractor

Deprecated: Android based YouTube URL extractor and downloader
Other
877 stars 304 forks source link

i got this exeception java.io.FileNotFoundException: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE #176

Open shailendra-rajpoot opened 3 years ago

shailendra-rajpoot commented 3 years ago

here is my dart code

class MainActivity: FlutterActivity() { private val CHANNEL = "channelForNativeCode"

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
    super.configureFlutterEngine(flutterEngine)
    MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
        // Note: this method is invoked on the main thread.
        call, result ->
        if (call.method == "nativeMethodCall") {
            var id = call.argument<String>("id").toString()
            var iTag = call.argument<String>("iTag").toString()

            // my function to pass into the other
            fun getDecodedUrl(decodedUrl: String) {
                print("msg"+decodedUrl)
                if (decodedUrl!="") {
                    result.success(decodedUrl)
                } else {
                    result.error("UNAVAILABLE", decodedUrl, null)
                }

            }

           extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

                        } else {
            result.notImplemented()
        }
    }
}

private fun extractYoutubeUrl(url:String ,iTag:Int, sendResponse: (response: String) -> Unit){
    @SuppressLint("StaticFieldLeak") val mExtractor: YouTubeExtractor = object : YouTubeExtractor(this) {
        override fun onExtractionComplete(ytFiles: SparseArray<YtFile>, vMeta: VideoMeta) {
            if (ytFiles != null) {
                val itag = iTag
              var decodeUrl = ytFiles[itag].url
                //getUrl(decodeUrl)
                sendResponse(decodeUrl)
            }
        }
    }
    mExtractor.extract(url, true, true)

}

/* override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (!setSecureSurfaceView()) { Log.e("MainActivity", "Could not secure the MainActivity!") // React as appropriate. } window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE) }

private fun setSecureSurfaceView(): Boolean {
    val content = findViewById<ViewGroup>(android.R.id.content)
    if (!isNonEmptyContainer(content)) {
        return false
    }
    val splashView = content.getChildAt(0)
    if (!isNonEmptyContainer(splashView)) {
        return false
    }
    val flutterView = (splashView as ViewGroup).getChildAt(0)
    if (!isNonEmptyContainer(flutterView)) {
        return false
    }
    val surfaceView = (flutterView as ViewGroup).getChildAt(0)
    if (surfaceView !is SurfaceView) {
        return false
    }
    surfaceView.setSecure(true)
    this.window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
    return true
}

private fun isNonEmptyContainer(view: View): Boolean {
    if (view !is ViewGroup) {
        return false
    }
    if (view.childCount < 1) {
        return false
    }
    return true
}

*/ }

DatUET commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

ajstar12 commented 3 years ago

My All Live Project Getting Same Error.

DotProduct commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

This gets it working 100%. Thank you!!!!!!

shailendra-rajpoot commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE how to pass this parameter html5=1 in my extractYoutubeUrl()

extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

shailendra-rajpoot commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

how to pass this parameter html5=1 in my method extractYoutubeUrl()

extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

shailendra-rajpoot commented 3 years ago

how to pass this parameter html5=1 in my method extractYoutubeUrl()

extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

shailendra-rajpoot commented 3 years ago

how to pass this parameter html5=1 in my method extractYoutubeUrl()

extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

shailendra-rajpoot commented 3 years ago

how can i pass this parameter html5=1 in my method plz tell me

extractYoutubeUrl()

extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

sametserpil commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

Thank you sir. This works like a charm!

amitchandelatpstar commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

Thank you sir. This works like a charm!

i'm using in kotlin

@SuppressLint("StaticFieldLeak")
private fun extractYoutubeUrl(tempVideo: Video?) {
    object : YouTubeExtractor(requireActivity()) {
        @Override
        override fun onExtractionComplete(ytFiles: SparseArray<YtFile?>?, vMeta: VideoMeta?) {
            if (ytFiles != null) {
                val itag = 22
                downloadUrl = ytFiles.get(itag)?.url ?: ""
                playerManager?.setVideoUrl(downloadUrl, true)
                Toast.makeText(requireActivity(), "complete", Toast.LENGTH_LONG).show()
            } else {
                Toast.makeText(requireActivity(), "Error", Toast.LENGTH_LONG).show()
            }
        }
    }.extract(youtubeLink, true, false)

it's working on before yesterday but now i got
https://www.youtube.com/get_video_info?video_id=4xlUWLG9goc&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2F4xlUWLG9goc
could you please help me

amitchandelatpstar commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

This gets it working 100%. Thank you!!!!!!

could you help me i'm using in kotlin i pass this URl : https://youtu.be/4xlUWLG9goc&html5=1

@SuppressLint("StaticFieldLeak") private fun extractYoutubeUrl(tempVideo: Video?) { object : YouTubeExtractor(requireActivity()) { @Override override fun onExtractionComplete(ytFiles: SparseArray<YtFile?>?, vMeta: VideoMeta?) { if (ytFiles != null) { val itag = 22 downloadUrl = ytFiles.get(itag)?.url ?: "" playerManager?.setVideoUrl(downloadUrl, true) Toast.makeText(requireActivity(), "complete", Toast.LENGTH_LONG).show() } else { Toast.makeText(requireActivity(), "Error", Toast.LENGTH_LONG).show() } } }.extract(youtubeLink, true, false)

it's working on before yesterday but now i got https://www.youtube.com/get_video_info?video_id=4xlUWLG9goc&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2F4xlUWLG9goc could you please help me

shailendra-rajpoot commented 3 years ago

this URl : https://youtu.be/4xlUWLG9goc&html5=1 you can not pass like this on kotlin. this is my kotlin code this help you sure package com.TezLaxami.pvt.ltd.GalavAcademy

import android.annotation.SuppressLint import android.util.SparseArray import androidx.annotation.NonNull import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.android.FlutterActivity import io.flutter.plugin.common.MethodChannel import io.flutter.plugins.VideoMeta import io.flutter.plugins.YouTubeExtractor import io.flutter.plugins.YtFile

class MainActivity: FlutterActivity() { private val CHANNEL = "channelForNativeCode"

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
    super.configureFlutterEngine(flutterEngine)
    MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
        // Note: this method is invoked on the main thread.
        call, result ->
        if (call.method == "nativeMethodCall") {
            var id = call.argument<String>("id").toString()
            var iTag = call.argument<String>("iTag").toString()

            // my function to pass into the other
            fun getDecodedUrl(decodedUrl: String) {
                print("msg"+decodedUrl)
                if (decodedUrl!="") {
                    result.success(decodedUrl)
                } else {
                    result.error("UNAVAILABLE", decodedUrl, null)
                }

            }

            extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

        } else {
            result.notImplemented()
        }
    }
}

private fun extractYoutubeUrl(url:String ,iTag:Int, sendResponse: (response: String) -> Unit){
    @SuppressLint("StaticFieldLeak") val mExtractor: YouTubeExtractor = object : YouTubeExtractor(this) {
        override fun onExtractionComplete(ytFiles: SparseArray<YtFile>, vMeta: VideoMeta) {
            if (ytFiles != null) {
                val itag = iTag
                var decodeUrl = ytFiles[itag].url
                //getUrl(decodeUrl)
                sendResponse(decodeUrl)
            }
        }
    }
    mExtractor.extract(url, true, true)

}

}

and add download FtFile.java , YouTubeExtractor.java , VideoMeta.java , Formate.java from here https://github.com/HaarigerHarald/android-youtubeExtractor/tree/master/youtubeExtractor/src/main/java/at/huber/youtubeExtractor and add it inside your java folder inside package and modifi YouTubeExtractor.java on line no 207 like this String ytInfoUrl = (useHttp) ? "http://" : "https://"; ytInfoUrl += "www.youtube.com/get_video_info?video_id=" + videoID + "&html5=1" + "&eurl="

shailendra-rajpoot commented 3 years ago

this URl : https://youtu.be/4xlUWLG9goc&html5=1 you can not pass like this on kotlin. this is my kotlin code this help you sure package com.TezLaxami.pvt.ltd.GalavAcademy

import android.annotation.SuppressLint import android.util.SparseArray import androidx.annotation.NonNull import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.android.FlutterActivity import io.flutter.plugin.common.MethodChannel import io.flutter.plugins.VideoMeta import io.flutter.plugins.YouTubeExtractor import io.flutter.plugins.YtFile

class MainActivity: FlutterActivity() { private val CHANNEL = "channelForNativeCode"

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { // Note: this method is invoked on the main thread. call, result -> if (call.method == "nativeMethodCall") { var id = call.argument("id").toString() var iTag = call.argument("iTag").toString()

        // my function to pass into the other
        fun getDecodedUrl(decodedUrl: String) {
            print("msg"+decodedUrl)
            if (decodedUrl!="") {
                result.success(decodedUrl)
            } else {
                result.error("UNAVAILABLE", decodedUrl, null)
            }

        }

        extractYoutubeUrl("https://www.youtube.com/watch?v=$id",iTag.toInt(),::getDecodedUrl)

    } else {
        result.notImplemented()
    }
}

}

private fun extractYoutubeUrl(url:String ,iTag:Int, sendResponse: (response: String) -> Unit){ @SuppressLint("StaticFieldLeak") val mExtractor: YouTubeExtractor = object : YouTubeExtractor(this) { override fun onExtractionComplete(ytFiles: SparseArray, vMeta: VideoMeta) { if (ytFiles != null) { val itag = iTag var decodeUrl = ytFiles[itag].url //getUrl(decodeUrl) sendResponse(decodeUrl) } } } mExtractor.extract(url, true, true)

}

}

and download FtFile.java , YouTubeExtractor.java , VideoMeta.java , Formate.java from here https://github.com/HaarigerHarald/android-youtubeExtractor/tree/master/youtubeExtractor/src/main/java/at/huber/youtubeExtractor and add it inside your java folder inside package and modifi YouTubeExtractor.java on line no 207 like this String ytInfoUrl = (useHttp) ? "http://" : "https://"; ytInfoUrl += "www.youtube.com/get_video_info?video_id=" + videoID + "&html5=1" + "&eurl="

amitchandelatpstar commented 3 years ago

thanks

On Fri, May 21, 2021 at 2:59 PM shailendra-rajpoot @.***> wrote:

this URl : https://youtu.be/4xlUWLG9goc&html5=1 you can not pass like this on kotlin. this is my kotlin code this help you sure package com.TezLaxami.pvt.ltd.GalavAcademy

import android.annotation.SuppressLint import android.util.SparseArray import androidx.annotation.NonNull import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.android.FlutterActivity import io.flutter.plugin.common.MethodChannel import io.flutter.plugins.VideoMeta import io.flutter.plugins.YouTubeExtractor import io.flutter.plugins.YtFile

class MainActivity: FlutterActivity() { private val CHANNEL = "channelForNativeCode"

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { // Note: this method is invoked on the main thread. call, result -> if (call.method == "nativeMethodCall") { var id = call.argument("id").toString() var iTag = call.argument("iTag").toString()

// my function to pass into the other fun getDecodedUrl(decodedUrl: String) { print("msg"+decodedUrl) if (decodedUrl!="") { result.success(decodedUrl) } else { result.error("UNAVAILABLE", decodedUrl, null) }

}

extractYoutubeUrl("https://www.youtube.com/watch?v=$id ",iTag.toInt(),::getDecodedUrl)

} else { result.notImplemented() } } }

private fun extractYoutubeUrl(url:String ,iTag:Int, sendResponse: (response: String) -> Unit){ @SuppressLint("StaticFieldLeak") val mExtractor: YouTubeExtractor = object : YouTubeExtractor(this) { override fun onExtractionComplete(ytFiles: SparseArray, vMeta: VideoMeta) { if (ytFiles != null) { val itag = iTag var decodeUrl = ytFiles[itag].url //getUrl(decodeUrl) sendResponse(decodeUrl) } } } mExtractor.extract(url, true, true)

}

}

and download FtFile.java , YouTubeExtractor.java , VideoMeta.java , Formate.java from here

https://github.com/HaarigerHarald/android-youtubeExtractor/tree/master/youtubeExtractor/src/main/java/at/huber/youtubeExtractor and add it inside your java folder inside package and modifi YouTubeExtractor.java on line no 207 like this String ytInfoUrl = (useHttp) ? "http://" : "https://"; ytInfoUrl += "www.youtube.com/get_video_info?video_id=" + videoID + "&html5=1" + "&eurl="

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/HaarigerHarald/android-youtubeExtractor/issues/176#issuecomment-845818865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUE6CBVIZUFNR422G5ZV6QDTOYRXZANCNFSM45GU5C2A .

kishanverma26 commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

not working suddenly it stop working

qyzhaojinxi commented 3 years ago

Hi, not working now. Is there any way to solve?

qyzhaojinxi commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

@DotProduct Hi, how did you know to add html5=1? Now it's not working again.

DatUET commented 3 years ago

add html5=1 in your link. Sample: https://www.youtube.com/get_video_info?video_id=Ls-blYpVgwE&html5=1&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FLs-blYpVgwE

@DotProduct Hi, how did you know to add html5=1? Now it's not working again.

Sorry there is currently no solution. Looks like google is shutting down get_video_info.

qyzhaojinxi commented 3 years ago

I found some tools still work now. But I don't know how. like this: https://yt1s.com/en6

qyzhaojinxi commented 3 years ago

I found some info in this link. But I don't if it helps. https://www.youtube.com/s/player/da9443d1/player_ias.vflset/en_US/base.js

And in this link there is some info about get_video_info and some new params include html5=1. But the domain is different.

shailendra-rajpoot commented 3 years ago

any one have solutions ??

qyzhaojinxi commented 3 years ago

see this. it works.

https://github.com/HaarigerHarald/android-youtubeExtractor/issues/185#issuecomment-863892051

shailendra-rajpoot commented 3 years ago

"&html5=1" + "&c=TVHTML5"+ "&cver=6.20180913" after adding this it is not working today plz help

shailendra-rajpoot commented 3 years ago

"&html5=1" + "&c=TVHTML5"+ "&cver=6.20180913" after adding this it is not working today plz help