package main
import (
"encoding/json"
"fmt"
gom3uparser "github.com/zikwall/gom3u-content-parser"
)
func main() {
parser := gom3uparser.NewM3UContentParser().
LoadSource("https://iptv-org.github.io/iptv/countries/ru.m3u", false).
Parse()
jsonOutput, _ := json.Marshal(parser.Offset(2).Limit(3).All())
fmt.Println(string(jsonOutput))
}
func main() {
parser := gom3uparser.NewM3UContentParser().
LoadSource("https://iptv-org.github.io/iptv/countries/ru.m3u", false).
Parse()
for _, item := range parser.Limit(10).All() {
fmt.Println(fmt.Sprintf("Language is: %s, Group is: %s", item.TvgLanguage, item.GroupTitle))
}
}
fmt.Println(parser.GetTvgUrl())
go get github.com/zikwall/gom3u-content-parser
Origin tvg-id
, tvg-logo
transform to TvgId
and TvgLogo
objects
-
Id
-
TvgId
-
TvgName
-
TvgUrl
-
TvgLogo
-
TvgCountry
-
TvgLanguage
-
TvgShift
-
AudioTrack
-
AudioTrackNum
-
Censored
-
GroupId
-
GroupTitle
-
ExtGrp
-
ExtraAttributes
(all original attributes in m3u item after parsing)
-
GetTvgUrl()
: string -
GetM3UContent()
: string -
GetDirtyItems()
: []string - Return m3u item lines before parsing -
GetItems()
: []M3UItem - Return all items after parsing -
Offset(int offset)
: M3UContentParser - Set offset for returned results -
Limit(int limit)
: M3UContentParser - Set limits for returned results -
Cache
-
Refresh
-
CountItems
-
TvgUrl
For all questions and suggestions - welcome to Issues