Project

General

Profile

export playlist with curl not working

Added by Lukáš Hájnik over 2 years ago

Hello everyone. I have been using TVheadend for about 5 years, version 4.2.8-36. A few days ago I deployed a new unstable 4.3-2010 on my Debian 11. The thing is, I used curl to export a playlist and an xmltv EPG timed in crontab. curl worked in version 4.2.8-36, but in the new 4.3-2010 it can't save the playlist correctly. My command looks like this:
http: // user: pass @ IP: 9981 / playlist / auth / tagname / Sport
If I put this url in a web browser, the Sport.m3u playlist with the inserted auth code will be downloaded immediately, which is great, but it would be even better if curl could do it. Thanks for the help.


Replies (5)

RE: export playlist with curl not working - Added by Dave Pickles over 2 years ago

What is the output of your curl command?

Have you seen the (unofficial) API docs at https://github.com/dave-p/TVH-API-docs/wiki/Other-Functions#playlist ?

According to the docs (which may be wrong), /playlist/auth/tagname/ uses Persistent Authentication, so you would need to append the persistent auth code as a parameter eg

http://user:pass@IP:9981/playlist/auth/tagname/Sport?auth=8ef7aa08e516060ca4330730c60e00d5b5174920

RE: export playlist with curl not working - Added by Lukáš Hájnik over 2 years ago

I also tried to export the playlist as follows:
  1. curl http://sport:[email protected]:9981/playlist
    the answer was:
    [[<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <HTML><HEAD>
    <TITLE>401 Unauthorized</TITLE>
    </HEAD><BODY>
    <H1>401 Unauthorized</H1>
    <P STYLE="text-align: center; margin: 2em"><A HREF="/" STYLE="border: 1px solid; border-radius: 4px; padding: .6em">Default login</A></P><P STYLE="text-align: center; margin: 2em"><A HREF="/login" STYLE="border: 1px solid; border-radius: 4px; padding: .6em">New login</A></P></BODY></HTML>]]
So I tried to add the authorization code to the URL
  1. curl http://sport:[email protected]:9981/playlist/auth?auth={authcode}
    the answer was:
    [[<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <HTML><HEAD>
    <TITLE>401 Unauthorized</TITLE>
    </HEAD><BODY>
    <H1>401 Unauthorized</H1>
    <P STYLE="text-align: center; margin: 2em"><A HREF="/" STYLE="border: 1px solid; border-radius: 4px; padding: .6em">Default login</A></P><P STYLE="text-align: center; margin: 2em"><A HREF="/login" STYLE="border: 1px solid; border-radius: 4px; padding: .6em">New login</A></P></BODY></HTML>]]
or
  1. curl http://sport:[email protected]:9981/playlist/auth/tagname/Sport?auth=PvVFdEWH0KBAicrbLLqDkOZqKXKM
    the answer was:
    [[<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <HTML><HEAD>
    <TITLE>401 Unauthorized</TITLE>
    </HEAD><BODY>
    <H1>401 Unauthorized</H1>
    <P STYLE="text-align: center; margin: 2em"><A HREF="/" STYLE="border: 1px solid; border-radius: 4px; padding: .6em">Default login</A></P><P STYLE="text-align: center; margin: 2em"><A HREF="/login" STYLE="border: 1px solid; border-radius: 4px; padding: .6em">New login</A></P></BODY></HTML>]]

Note that all 3 URLs above, when I enter a web browser, the playlist downloads and I can play it on my PC.
Thanks.

RE: export playlist with curl not working - Added by saen acro over 2 years ago

You not use correct URL for CURL

curl http://sport:[email protected]:9981/playlist

must be
curl http://sport:[email protected]:9981/playlist/channels

Other problem is that you use plain authentication, when in your settings is set digest
add something as this

curl http://10.10.10.244:9981/playlist/auth/channels --digest -u sport:sport

RE: export playlist with curl not working - Added by Lukáš Hájnik over 2 years ago

saen acro wrote:

You not use correct URL for CURL
[...]
must be
[...]

Other problem is that you use plain authentication, when in your settings is set digest
add something as this
[...]

this not working
  1. curl http://sport:[email protected]:9981/playlist/channels
    I will get the same result as written above

this works:
curl http://10.10.10.244:9981/playlist/auth/channels --digest -u sport:sport

when I only want to download a specific tag? so like this?
  1. curl http://10.10.10.244:9981/playlist/auth/tagname/Sport --digest -u sport:sport
    Thanks

RE: export playlist with curl not working - Added by saen acro over 2 years ago

Get tags list

:9981/playlist/tags/

and select the one you need.

    (1-5/5)