android-youtubeExtractor icon indicating copy to clipboard operation
android-youtubeExtractor copied to clipboard

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

Open shailendra-rajpoot opened this issue 3 years ago • 24 comments

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
}

*/ }

shailendra-rajpoot avatar May 20 '21 10:05 shailendra-rajpoot

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

DatUET avatar May 20 '21 11:05 DatUET

My All Live Project Getting Same Error.

ajstar12 avatar May 20 '21 12:05 ajstar12

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!!!!!!

DotProduct avatar May 20 '21 12:05 DotProduct

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 avatar May 20 '21 15:05 shailendra-rajpoot

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 avatar May 20 '21 17:05 shailendra-rajpoot

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

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

shailendra-rajpoot avatar May 20 '21 17:05 shailendra-rajpoot

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

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

shailendra-rajpoot avatar May 20 '21 17:05 shailendra-rajpoot

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)

shailendra-rajpoot avatar May 20 '21 17:05 shailendra-rajpoot

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!

sametserpil avatar May 21 '21 06:05 sametserpil

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 avatar May 21 '21 08:05 amitchandelatpstar

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

amitchandelatpstar avatar May 21 '21 09:05 amitchandelatpstar

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=" + URLEncoder.encode("https://youtube.googleapis.com/v/" + videoID, "UTF-8"); it working fine i also using this

shailendra-rajpoot avatar May 21 '21 09:05 shailendra-rajpoot

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 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="

  • URLEncoder.encode("https://youtube.googleapis.com/v/" + videoID, "UTF-8"); it working fine i also using this

shailendra-rajpoot avatar May 21 '21 09:05 shailendra-rajpoot

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<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 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="

  • URLEncoder.encode("https://youtube.googleapis.com/v/" + videoID, "UTF-8"); it working fine i also using this

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

amitchandelatpstar avatar May 21 '21 09:05 amitchandelatpstar

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

kishanverma26 avatar Jun 16 '21 04:06 kishanverma26

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

qyzhaojinxi avatar Jun 18 '21 04:06 qyzhaojinxi

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.

qyzhaojinxi avatar Jun 18 '21 04:06 qyzhaojinxi

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.

DatUET avatar Jun 18 '21 06:06 DatUET

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

qyzhaojinxi avatar Jun 18 '21 07:06 qyzhaojinxi

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.

qyzhaojinxi avatar Jun 18 '21 07:06 qyzhaojinxi

any one have solutions ??

shailendra-rajpoot avatar Jun 18 '21 07:06 shailendra-rajpoot

see this. it works.

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

qyzhaojinxi avatar Jun 18 '21 10:06 qyzhaojinxi

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

shailendra-rajpoot avatar Jul 22 '21 05:07 shailendra-rajpoot

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

shailendra-rajpoot avatar Jul 22 '21 05:07 shailendra-rajpoot