Share My Creation Extract data from the github IPTV m3u file.

If you are looking for IPTV stations. Try this.

This script extract 11692 IPTV station and insert the data in a sqlite db.
The data is :
Web site URL
Country (based on url)
Group Ex. Music - News - Sport - ...
Station name
Stream URL
Logo URL (to download the station logo)
User-Agent (certain station requests a user agent)

When the process is finished you can save the db.

The database weighs 2.552Ko
Tested on I5 16Gb/Ram W11 Process time 20min 50sec (0,10sec by station)
 

Attachments

  • sample1.png
    sample1.png
    21.2 KB · Views: 1,387
  • sample2.png
    sample2.png
    344.4 KB · Views: 838
  • M3UtoSQLiteDB.zip
    14.1 KB · Views: 1,103

zed

Active Member
Licensed User
I tried your file. I didn't encounter any errors.
The name, stream and logo are correct. For the rest, there is no data
 

Attachments

  • Test_Result.png
    Test_Result.png
    343.7 KB · Views: 255

Scantech

Well-Known Member
Licensed User
Longtime User
It only works for reading channel lists from iptv.org (https://github.com/iptv-org/iptv).

Here is another one https://m3u.cl/lista/total.m3u
from https://m3u.cl/lista-iptv-total.php
but parsing the list gives an error.

And I must say that it also complies with the M3U list standard.

list https://iptv-org.github.io/iptv/index.m3u

View attachment 156362

list: https://m3u.cl/lista/total.m3u
View attachment 156363
I tried that link with my app and did not work. Also, popular iptv app did not work, either. Is the link valid?

 

TILogistic

Expert
Licensed User
Longtime User
My App has a loading time of iptv-org of:
Time: 1.55 Seconds
Records: 11,689
In loading and displaying the list, I don't see the need for a database, as I said before the channel links change, and the local database is not updated.

1724733207674.png


1724733277963.png

1724733796498.png
 
Last edited:

Scantech

Well-Known Member
Licensed User
Longtime User
Samsung S21 Ultra = parsing m3u file (46k records) into customlistview takes 280 ms. Parsing EPG xml file takes 370 ms. I use regex to parse both. Old, less power phone can take up to 1.5 seconds.

https://iptv-org.github.io/iptv/index.m3u takes 115 ms parse and display

B4a app
 
Last edited:

zed

Active Member
Licensed User
There are links that don't work. It is a static file. There are updates, but in this case you would have to do updates with each update. It's simpler to use the API.
Personally, I don't need all these stations. I found it easier to put everything in a database.
With a WHERE clause, the application is very fluid.
 

TILogistic

Expert
Licensed User
Longtime User
Dear friend, the index.m3u file is generated from those APIs.

In the example application I posted, I use that index.m3u file which I analyze and save in an in-memory database to perform the filters.

The routine that analyzes the file has 30 lines that also validates the URLs if they are valid (Logo and m3u8).

Note:
The routine even supports paid playlists.


I will soon publish the app which is multiplatform (B4X).
 
Last edited:

TILogistic

Expert
Licensed User
Longtime User
Samsung S21 Ultra = parsing m3u file (46k records) into customlistview takes 280 ms. Parsing EPG xml file takes 370 ms. I use regex to parse both. Old, less power phone can take up to 1.5 seconds.

https://iptv-org.github.io/iptv/index.m3u takes 115 ms parse and display

B4a app
Samsung S21 Ultra = parsing m3u file (46k records) into customlistview takes 280 ms.
46.000 Parsing in 280 ms. ?
115 ms. ?

I'd like to know what your algorithm is.
I checked your app that you posted in another post and the times were not as you mentioned.
 

TILogistic

Expert
Licensed User
Longtime User
Processing time results in B4J

Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
(Http client initialized with accept all option.)
Time Http Request: 1.69 Seconds
Time Parse: 0.19 Seconds
Records: 11,689
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
(Http client initialized with accept all option.)
Time Http Request: 1.46 Seconds
Time Parse: 0.06 Seconds
Records: 1,140

B4X:
    Dim starTime As Long = DateTime.Now
    Wait For (GetHttpRequest(ServerURL)) Complete (Result As String)
    Log($"Time Http Request: $1.2{(DateTime.Now - starTime) / DateTime.TicksPerSecond} Seconds"$)
 
    Dim starTime As Long = DateTime.Now
    ParsePlayList(Result)
    Log($"Time Parse: $1.2{(DateTime.Now - starTime) / DateTime.TicksPerSecond} Seconds"$)
    Log($"Records: $1.0{ChannelList.Size}"$)
 
Last edited:

Scantech

Well-Known Member
Licensed User
Longtime User
the times were without http request. That is what it shows in samsung 21 ultra with my example using regex. i do the following.

its not very efficient. like i said this can delay up to 1.5 second with slow device not including downloading http m3u file

B4X:
Sub CallAllChannelsProcess(Data As String)
    Dim startTime As Long = DateTime.Now
 
    ProcessM3UforAllChannels(Data)           'regex the file in here
    ChannelSortProcess                 
    AddBlankPCLV                         
    AddSpinnerCategories                 
    UpdateTitleLabelwithSize
    B4XPages.MainPage.PageEPG1.ArrangeXMLIconToMyM3uVariables

    Log("CallAllChannelsProcess: " & (DateTime.Now - startTime) & " ms")
    Log(" ")
End Sub
 
Last edited:

Similar Threads

Top