B4A Library [Class B4X ] YouTube V3

Hi all.
This is new version 2.00
Now is possibile NextPage and PreviousPage.
For any movie you have all details as:
Etag, Title, Description, PublisheAt, Urlpicture, categoryId, channelTitle, Definition, dimension, PrivacyStatus, dislikeCount, likeCount, viewCount, CommentCount, Duration
Note Duration return example: PT15M33S this is 15 minutes and 33 seconds.
And more.... this version is very fast look movie in youtube.


YouTubeList
Author:
Devil-App
Version: 2.05

YouTubeList
Author: Devil-App
Version: 2

  • Methods:
    • IsInitialized As Boolean

    • Tests whether the object has been initialized.
      [*]detailsvideo (id As String, Module As Object, EventName As String) As String


      Example
      yt.DeatilsVideo( id, Me, "details_page")

      id = Id Video YouTube type: "7lCDEYXw3mM"


      [*]initialize (key As String, Log as Boolean) As String

      [*]readingchannel (maxresult As Int, channelId As String, order As String, videoDuration As String, Module As Object, EventName As String) As String
      maxresult = 0 to 50
      channelId = example --> "UCe5xLaib7HmDPbBp132t_9A"
      order = date - rating - relevance - title - videoCount - viewCount ( if "" default value is relevance )
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )


      [*]readingchannelpage (nextpage As String, prevpage As String, maxresult As Int, channelId As String, order As String, videoDuration As String, Module As Object, EventName As String) As String


      Example
      For Next Page:
      yt.ReadingChannelPage(nextpage, "", maxresult, channelId, order, videoDuration, Me, "scroll_page")
      or
      For Previous Page
      yt.ReadingChannelPage("", prevpage, maxresult, channelId, order, videoDuration, Me, "scroll_page")

      maxresult = 0 to 50
      channelId = example --> "UCe5xLaib7HmDPbBp132t_9A"
      order = date - rating - relevance - title - videoCount - viewCount ( if "" default value is relevance )
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )


      [*]readingplaylist (maxresult As Int, playlistId As String, Module As Object, EventName As String) As String

      maxresult = 0 to 50
      playlistId = example --> "PL63F0C78739B09958"


      [*]readingplaylistpage (nextpage As String, prevpage As String, maxresult As Int, playlistId As String, Module As Object, EventName As String) As String


      Example
      For Next Page:
      yt.ReadingPlayListPage(nextpage, "", maxresult, playlistId, Me, "scroll_page")
      or
      For Previous Page
      yt.ReadingPlayListPage("", prevpage, maxresult, playlistId, Me, "scroll_page")

      maxresult = 0 to 50
      playlistId = example --> "PL63F0C78739B09958"


      [*]searchchannel (maxresult As Int, search As String, regionCode As String, videoDuration As String, Module As Object, EventName As String) As String

      maxresult = 0 to 50
      search = "Ricky Martin"
      regioncode = "IT" - "US" etc.
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )


      [*]searchchannelpage (nextpage As String, prevpage As String, maxresult As Int, search As String, regionCode As String, videoDuration As String, Module As Object, EventName As String) As String


      Example
      For Next Page:
      yt.SearchChannelPage(nextpage, "", maxresult, search, regionCode, videoDuration, Me, "scroll_page")
      or
      For Previous Page
      yt.SearchChannelPage("", prevpage, maxresult, search, regionCode, videoDuration, Me, "scroll_page")

      maxresult = 0 to 50
      search = "Ricky Martin"
      regioncode = "" is all or "IT" - "US" etc.
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )


      [*]searchplaylist (maxresult As Int, search As String, order As String, regionCode As String, videoDuration As String, Module As Object, EventName As String) As String

      maxresult = 0 to 50
      search = "Ricky Martin"
      order = date - rating - relevance - title - videoCount - viewCount ( if "" default value is revelance )
      regioncode = "IT" - "US" etc.
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )


      [*]searchplaylistpage (nextpage As String, prevpage As String, maxresult As Int, search As String, order As String, regionCode As String, videoDuration As String, Module As Object, EventName As String) As String


      Example
      For Next Page:
      yt.SearchPlayListPage(nextpage, "", maxresult, search, order, regionCode, videoDuration, Me, "scroll_page")
      or
      For Previous Page
      yt.SearchPlayListPage("", prevpage, maxresult, search, order, regionCode, videoDuration, Me, "scroll_page")

      maxresult = 0 to 50
      search = "Ricky Martin"
      order = date - rating - relevance - title - videoCount - viewCount ( if "" default value is revelance )
      regioncode = "IT" - "US" etc.
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )


      [*]searchvideo (maxresult As Int, search As String, order As String, regionCode As String, videoDuration As String, Module As Object, EventName As String) As String

      maxresult = 0 to 50
      search = "Ricky Martin"
      order = date - rating - relevance - title - videoCount - viewCount ( if "" default value is revelance )
      regioncode = "IT" - "US" etc. ( if "" default value is all world )
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )


      [*]searchvideopage (nextpage As String, prevpage As String, maxresult As Int, search As String, order As String, regionCode As String, videoDuration As String, Module As Object, EventName As String) As String


      Example
      For Next Page:
      yt.SearchVideoPage(nextpage, "", maxresult, search, order, "", "", Me, "scroll_page")
      or
      For Previous Page
      yt.SearchVideoPage("", prevpage, maxresult, search, order, "", "", Me, "scroll_page")

      nextpage = SVideo.nextpage(i)
      prevpage = SVideo.prevpage(i)
      maxresult = 0 to 50
      search = "Ricky Martin"
      order = date - rating - relevance - title - videoCount - viewCount ( if "" default value is revelance )
      regioncode = "IT" - "US" etc. ( if "" default value is all world )
      videoDuration = any - long( > 20 min.) - medium ( 4 min. to 20 min. ) - short ( if "" default value is any )




B4X:
Sub Activity_Create(FirstTime As Boolean)

    yt.Initialize(key)

    'For details Id Video
    'You have as Return:
    'Etag, Title, Description, PublisheAt, Urlpicture, categoryId, channelTitle, Definition, dimension,
    'PrivacyStatus, dislikeCount, likeCount, viewCount, CommentCount, Duration
    'Note Duration return example: PT15M33S this is 15 minutes and 33 seconds.
    'yt.DetailsVideo(id, Me,  "details_page")


    'yt.SearchVideo(maxresult, search, order, "", "", Me, "search_video")
    'yt.SearchVideoPage(nextpage, prevpage, maxresult, search, order, "", "", Me, "scroll_search_video")

    'yt.ReadingChannel(maxresult, channelId, order, "", Me, "reading_channel")
    'yt.ReadingChannelPage(nextpage, prevpage, maxresult, channelId, order, "", Me, "scroll_reading_channel")

    'yt.ReadingPlayList( maxresult, playlist, Me, "reading_playlist")
    yt.ReadingPlayListPage(nextpage, prevpage,maxresult, playlist, Me, "scroll_reading_playlist")

    'yt.SearchChannel( maxresult, search, "", "", Me, "search_channel")
    'yt.SearchChannelPage(nextpage, prevpage, maxresult, search, "", "", Me, "scroll_search_channel")

    'yt.SearchPlayList(maxresult, search, "", "", "", Me, "search_playlist")
    'yt.SearchPlayListPage(nextpage, prevpage, maxresult, search, "", "", "", Me, "scroll_search_playlist")






End Sub

Sub details_page(DVideo As DetailsVideo)

       LogColor("Title: " & DVideo.title(0), Colors.Blue)
        Log("Description: " & DVideo.description(0) )
        Log("Pubblished At: " &  DVideo.publishedAt(0) )
        Log("Url Pictures: " &  DVideo.urlpicture(0) )
        Log("Etag: " &  DVideo.Etag(0) )
        Log("CategoryId: " &  DVideo.CategoryId(0) )
        Log("ChannelTitle: " &  DVideo.channelTitle(0) )
        Log("Definition: " &  DVideo.Definition(0) )
        Log("Dimension: " &  DVideo.Dimension(0) )
        Log("PrivacyStatus: " &  DVideo.PrivacyStatus(0) )
        Log("disLikeCount: " &  DVideo.DislikeCount(0) )
        Log("LikeCount: " &  DVideo.LikeCount(0) )
        Log("ViewCount: " &  DVideo.ViewCount(0) )
        Log("CommentCount: " &  DVideo.CommentCount(0) )
        Log("Duration: " &  DVideo.Duration(0) )


End Sub

Sub search_video(SVideo As SearchVideo)



    LogColor("Total Results: " & SVideo.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To SVideo.TotalChannel - 1
        LogColor("Title: " & SVideo.title(p1), Colors.Blue)
        Log("Description: " & SVideo.description(p1) )
        Log("Pubblished At: " &  SVideo.publishedAt(p1) )
        Log("Url Pictures: " &  SVideo.urlpicture(p1) )
        Log("ID Video: " & SVideo.idVideo(p1) )
        Log("Next Page: " & SVideo.nextpage(p1))
        Log("Prev Page: " & SVideo.prevpage(p1))
    Next



End Sub

Sub reading_channel(RChannel As ReadChannel)

    LogColor("Total Results: " & RChannel.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To RChannel.TotalChannel - 1
        LogColor("Title: " & RChannel.title(p1), Colors.Blue)
        Log("Description: " & RChannel.description(p1) )
        Log("Pubblished At: " &  RChannel.publishedAt(p1) )
        Log("Url Pictures: " &  RChannel.urlpicture(p1) )
        Log("ID Channel: " &  RChannel.idChannel(p1) )
        Log("Play List ID: " & RChannel.playlistid(p1) )
    Next

End Sub




Sub reading_playlist(RPList As ReadingPlayList)

    LogColor("Total Results: " & RPList.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To RPList.TotalChannel - 1
        LogColor("Title: " & RPList.title(p1), Colors.Blue)
        Log("Description: " & RPList.description(p1) )
        Log("Pubblished At: " &  RPList.publishedAt(p1) )
        Log("Url Pictures: " &  RPList.urlpicture(p1) )
        Log("ID Video: " & RPList.idVideo(p1) )
    Next

End Sub

Sub search_channel(SChannel As SearchChannel)

    LogColor("Total Results: " & SChannel.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To SChannel.TotalChannel - 1
        LogColor("Title: " & SChannel.title(p1), Colors.Blue)
        Log("Channel Title: " & SChannel.ChannelTitle(p1))
        Log("Description: " & SChannel.description(p1) )
        Log("Pubblished At: " &  SChannel.publishedAt(p1) )
        Log("Url Pictures: " &  SChannel.urlpicture(p1) )
        Log("ID Channel: " &  SChannel.ChannelId(p1) )
    Next

End Sub



Sub search_playlist(SPList As SearchPlayList)

    LogColor("Total Results: " & SPList.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To SPList.TotalChannel - 1
        LogColor("Title: " & SPList.title(p1), Colors.Blue)
        Log("Channel Title: " & SPList.ChannelTitle(p1))
        Log("Description: " & SPList.description(p1) )
        Log("Pubblished At: " &  SPList.publishedAt(p1) )
        Log("Url Pictures: " &  SPList.urlpicture(p1) )
        Log("ID PlayList: " &  SPList.PlayListId(p1) )
    Next

End Sub



'**********Scroll

Sub scroll_search_video(Svideo As SearchVideo)

        LogColor("Total Results: " & Svideo.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To Svideo.TotalChannel - 1
        LogColor("Title: " & Svideo.title(p1), Colors.Blue)
        Log("Description: " & Svideo.description(p1) )
        Log("Pubblished At: " &  Svideo.publishedAt(p1) )
        Log("Url Pictures: " &  Svideo.urlpicture(p1) )
        Log("ID Video: " & Svideo.idVideo(p1) )
        Log("Next Page: " & Svideo.nextpage(p1))
        Log("Prev Page: " & Svideo.prevpage(p1))
        If p1 = 0 Then
            nextpage = Svideo.nextpage(p1)
            prevpage = Svideo.prevpage(p1)
        End If
    Next

 

End Sub


Sub scroll_reading_channel(RChannel As ReadChannel)

    LogColor("Total Results: " & RChannel.totalResults, Colors.Red)


    Dim p1 As Int
    For p1 = 0 To RChannel.TotalChannel - 1
        LogColor("Title: " & RChannel.title(p1), Colors.Blue)
        Log("Description: " & RChannel.description(p1) )
        Log("Pubblished At: " &  RChannel.publishedAt(p1) )
        Log("Url Pictures: " &  RChannel.urlpicture(p1) )
        Log("ID Channel: " &  RChannel.idChannel(p1) )
        Log("Play List ID: " & RChannel.playlistid(p1) )
        If p1 = 0 Then
            nextpage = RChannel.nextpage(p1)
            prevpage = RChannel.prevpage(p1)
        End If
    Next

End Sub

Sub scroll_reading_playlist(RPList As ReadingPlayList)

    LogColor("Total Results: " & RPList.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To RPList.TotalChannel - 1
        LogColor("Title: " & RPList.title(p1), Colors.Blue)
        Log("Description: " & RPList.description(p1) )
        Log("Pubblished At: " &  RPList.publishedAt(p1) )
        Log("Url Pictures: " &  RPList.urlpicture(p1) )
        Log("ID Video: " & RPList.idVideo(p1) )
        If p1 = 0 Then
            nextpage = RPList.nextpage(p1)
            prevpage = RPList.prevpage(p1)
        End If
    Next

End Sub

Sub scroll_search_channel(SChannel As SearchChannel)

    LogColor("Total Results: " & SChannel.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To SChannel.TotalChannel - 1
        LogColor("Title: " & SChannel.title(p1), Colors.Blue)
        Log("Channel Title: " & SChannel.ChannelTitle(p1))
        Log("Description: " & SChannel.description(p1) )
        Log("Pubblished At: " &  SChannel.publishedAt(p1) )
        Log("Url Pictures: " &  SChannel.urlpicture(p1) )
        Log("ID Channel: " &  SChannel.ChannelId(p1) )
        If p1 = 0 Then
            nextpage = SChannel.nextpage(p1)
            prevpage = SChannel.prevpage(p1)
        End If
    Next

End Sub

Sub scroll_search_playlist(SPList As SearchPlayList)

    LogColor("Total Results: " & SPList.totalResults, Colors.Red)

    Dim p1 As Int
    For p1 = 0 To SPList.TotalChannel - 1
        LogColor("Title: " & SPList.title(p1), Colors.Blue)
        Log("Channel Title: " & SPList.ChannelTitle(p1))
        Log("Description: " & SPList.description(p1) )
        Log("Pubblished At: " &  SPList.publishedAt(p1) )
        Log("Url Pictures: " &  SPList.urlpicture(p1) )
        Log("ID PlayList: " &  SPList.PlayListId(p1) )
        If p1 = 0 Then
            nextpage = SPList.nextpage(p1)
            prevpage = SPList.prevpage(p1)
        End If
    Next

End Sub

'Next Page
Sub Activity_Click

    Log("*********************")
    'yt.SearchVideoPage(nextpage, "", maxresult, search, order, "", "", Me, "scroll_search_video")
    'yt.ReadingChannelPage(nextpage, "", maxresult, channelId, order, "", Me, "scroll_reading_channel")
    'yt.ReadingPlayListPage(nextpage, "",maxresult, playlist, Me, "scroll_reading_playlist")
    'yt.SearchChannelPage(nextpage, "", maxresult, search, "", "", Me, "scroll_search_channel")
    yt.SearchPlayListPage(nextpage, "", maxresult, search, "", "", "", Me, "scroll_search_playlist")


End Sub

'Previous Page
Sub Activity_LongClick
    Log("*********************")
    'yt.SearchVideoPage("", prevpage, maxresult, search, order, "", "", Me,  "scroll_search_video")
    'yt.ReadingChannelPage("", prevpage, maxresult, channelId, order, "", Me, "scroll_reading_channel")
    'yt.ReadingPlayListPage("", prevpage,maxresult, playlist, Me, "scroll_reading_playlist")
    'yt.SearchChannelPage("", prevpage, maxresult, search, "", "", Me, "scroll_search_channel")
    yt.SearchPlayListPage("", prevpage, maxresult, search, "", "", "", Me, "scroll_search_playlist")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

This example that you can download ( Apk ) utilize also ULV By Informatix and Universal Image Loader By Don Mandred



IF YOU TRY APK --> CLICK HERE
IN ATTACHMENT CLASS COMPATIBLE FOR B4X ( B4A, B4i )


 

Attachments

  • youtube.bas
    33.6 KB · Views: 402
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Thanks. Work great and erel YouTube library.

Victor
The next time is sufficient LIKE
upload_2017-8-25_21-10-15.png

Have nice day
 

victormedranop

Well-Known Member
Licensed User
Longtime User
Hi, i'm having and error with this version. when I go next page from youtubelist always return the same rows.
I try with the demo. and in my old apk that I made 1 year ago.

Victor
 

MarcoRome

Expert
Licensed User
Longtime User
Hi, i'm having and error with this version. when I go next page from youtubelist always return the same rows.
I try with the demo. and in my old apk that I made 1 year ago.

Victor

I've tried now with version 2.05. I don't have this problem. Check the code correctly if there are new pages available

 

MODERN TALKING

Active Member
Licensed User
Longtime User
Hi Marco,

From the comments, seems like your Library is fantastic

Please tell me if this is possible with your Library:

1. User launches my App - which stays in background "listening"
2. User launches Youtube App
3. User watches a particular Video on Youtube App
4. User presses VOLUME UP Button
5. My app fetches the VideoID

If this feature not available - is it possible for you to ADD to your Library this function and I pay you for this work?

Thank you,

"Goldielocks" Goldman
 

MODERN TALKING

Active Member
Licensed User
Longtime User
Marco,

With Youtube Data API can my App communicate with the Youtube App - or at least GET INFORMATION from it?

Thank you,

Franz Reuther
 

DonManfred

Expert
Licensed User
Longtime User

MODERN TALKING

Active Member
Licensed User
Longtime User
Danke mein freund

So the ONLY way is to utilise Marco's Library and search and play Youtube Videos there - then can get VideoID - jawohl?
 
Top