B4A Library youtube-dl-android YouTube url extractor

Base this lib but i updated to newest version because this wrapper current dont work because out-update

This is a wrapper for an Android adaption of YouTube-DL. It was written by tastelessjolt and can be found on his/her repository on GitHub:

These are the urls to the YouTube video or audio files, so you can stream or download them. It features an age verification circumvention and a signature deciphering method (mainly for vevo videos).

Copy file android-youtubeExtractor-master-SNAPSHOT.aar to your Additional Lib folder

#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim NativeMe As JavaObject
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    NativeMe.RunMethod("getlinkyt", Array As Object("https://www.youtube.com/watch?v=nRrXhgEqJMI"))
    Wait For finishgetlink(listlink As List)
    For i=0 To listlink.Size-1
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

import android.util.SparseArray;
import java.util.ArrayList;
import at.huber.youtubeExtractor.VideoMeta;
import at.huber.youtubeExtractor.YouTubeExtractor;
import at.huber.youtubeExtractor.YtFile;
import anywheresoftware.b4a.keywords.Common;
import anywheresoftware.b4a.objects.collections.List;
public void getlinkyt(String linkyt){
        String youtubeLink = linkyt;
        new YouTubeExtractor(this) {
            public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
                ArrayList<String> dslink = new ArrayList<String>();
                List list = new List();
                if (ytFiles != null) {
                    for (int i = 0, itag; i < ytFiles.size(); i++) {
                        itag = ytFiles.keyAt(i);
                        YtFile ytFile = ytFiles.get(itag);
                        //BA.Log("Str " + ytFile.toString());
                        // String downloadUrl = ytFiles.get(itag).getUrl();
            //    BA.Log("Finish");

              processBA.raiseEventFromDifferentThread(this, null, 0, "finishgetlink", false, new Object[] {list});
        }.extract(youtubeLink, true, true);

#End If


  • share4b4x4rum.zip
    8.6 KB · Views: 272
  • android-youtubeExtractor-master-SNAPSHOT.zip
    33.9 KB · Views: 291


Licensed User
Longtime User
Internetpermission is missing in the Example. in this case it is returning an empty list.


AddPermission(android.permission.INTERNET) ' Allows applications to open network sockets.
AddPermission(android.permission.ACCESS_NETWORK_STATE) ' Allows applications to access information about networks.
to the manifest to get it working.