Sajjad Javed
Sajjad Javed

Reputation: 149

parser m3u file using java in android studio

i am looking to parser m3u file in java. channel name then its link I've googled for this but unable to find solution. m3u file looks like this:

#EXTM3U
#EXTINF:-1,VIP AR: Bein Max 1 HD
http://portal.onlineiptv.net:5210/live/Jyw2SMYjxe/9589.ts
#EXTINF:-1,VIP AR: Bein Max 2 HD
http://portal.onlineiptv.net:5210/live/Jyw2SMYjxe/9590.ts
#EXTINF:-1,VIP AR: Bein Max 3 HD
http://portal.onlineiptv.net:5210/live/Jyw2SMYjxe/9591.ts

i want to show the details like this:

ChannelCategory - ChannelName
Url of that channel 

i have a working code but in that i'm unable to fetch channels links

Upvotes: 2

Views: 7894

Answers (2)

Aaron Cruz
Aaron Cruz

Reputation: 11

java m3u parser - SimpleM3UParser

ArrayList<SimpleM3UParser.M3U_Entry> mParser = new SimpleM3UParser().parse("http://....m3u");

  for(int i=0; i < mParser.size(); i++){
         mParser.get(i).getName();
         mParser.get(i).getUrl();
         //.... etc
     }

Upvotes: 1

Sajjad Javed
Sajjad Javed

Reputation: 149

You can parse M3U file in C# using Regular expressions & in Java you can do same Or create custom Parser.

https://github.com/sajjad0321/iptv

Upvotes: 1

Related Questions