Roshan-R / termv

A terminal iptv player written in bash
GNU General Public License v3.0
232 stars 21 forks source link

termv stopped working - change in iptv json format #35

Closed Ved-un closed 1 year ago

Ved-un commented 1 year ago

Thank you so much for your project!

But today my termv stopped working for some reason. I clicked on the link https://iptv-org.github.io/iptv/channels.json and this page does not exist. They have this https://iptv-org.github.io/api/channels.json - I tried pasting this address but termv still doesn't work.

Did they change something or am I having a malfunction?

Roshan-R commented 1 year ago

It looks like iptv-org has changed the format of the underlying json. Looks like we have to change some of the json parsing for it to work.

Roshan-R commented 1 year ago

as a temporary solution, you could export the environment variable TERMV_API_URL to point to a backup of the old json I have made and continue using termv. To do this -

  1. Export TERMV_API_URL to https://gist.githubusercontent.com/Roshan-R/96c859fc551527284531f59fb52f18df/raw/8c7769a13484111d98339359472174f6ae6ac889/gistfile1.txt
  2. run termv - u
  3. Enjoy
Roshan-R commented 1 year ago

The changes to the json structure is pretty big for a quick fix. I suppose it would take some time to come up with a solution

Ved-un commented 1 year ago

I don't have a backup of json. Alright, I'll use pure mpv and my iptv playlists for now.

timsofteng commented 1 year ago

@Roshan-R dtill doesn't work automatically... And a lot of channels from your bellow tip don't work. May you please provide updated link or fix it? Thanks

Roshan-R commented 1 year ago

I have implemented a fix for this issue into a new branch named fix. Could you check if it's working or not?

divcyb commented 1 year ago

It kinda works thank you, but some channels error out like this Fetching channel, please wait... [file] Cannot open file '': No such file or directory Failed to open .

Roshan-R commented 1 year ago

Those are the channels which do not have a url in the json files. since both of them are split, it's very computationally heavy to filter out the channels which do not have a url

odnar-dev commented 1 year ago

hi @Roshan-R , why not move the filtering to the update function? instead of just downloading both files and storing them in their original format, you can process them (merge both files into one, remove channels without url...)

we can also create a json schema specific to termv (easy to read, and easy to reproduce if the user wants to create his own channel list).

[
    {
        "id" : null,
        "name" : "channel name",
        "categories" : ["category1","category2"],
        "languages" : ["en","ar"],
        "countries" : ["US","MA"],
        "url" : "http : //url.com/video.m3u8",
        "headers" : {"user_agent" : null,"http_referrer" : null},
        "logo" : null,
        "website" : null
    }
]
Roshan-R commented 1 year ago

That seems like a great idea @odnar-dev, I too was thinking of making something like this.

  1. What all should be included into the json schema? I feel like we should only store the data that we really want and that would be name, categories, languages, is_nsfw and the url.
  2. I'm also curious about the speed of processing this data
Roshan-R commented 1 year ago

I have updated the fix branch having implemented the idea suggested by @odnar-dev, the two json files are merged into a single one in the update function. This also fixes the issue raised by @divcyb about showing channels which do not have any urls pointed to it

odnar-dev commented 1 year ago

:laughing: i was about to suggest

image

Roshan-R commented 1 year ago

I guess we could merge the fix branch with the main branch?

sekret1 commented 1 year ago

I'd vote for "not yet":

$ termv
parse error: Invalid numeric literal at line 1, column 10

I've run the latest version from fix / main

$ termv -v
termv 1.4

edit: After deleting ~/.cache/termv I get this output:

$ termv
Downloading https://iptv-org.github.io/api/channels.json...  Done!
Downloading https://iptv-org.github.io/api/streams.json...  Done!
jq: error: Could not open file /home/sekret/.cache/termv/data.json: No such file or directory
Roshan-R commented 1 year ago

@sekret1 I have added a new commit to the fix branch, could you see if it works now?

sekret1 commented 1 year ago

Works without flaws now :1st_place_medal: