Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API Query
#1
I make a query api via html.
I would like to do it with python.

HTML:

Result:
Output:
URL http://ndrfs-lh.akamaihd.net/i/ndrfs_nds@430233/master.m3u8
My attempt with python

import json
import requests

url = 'https://mediathekviewweb.de/api/query'
headers = {'Content-Type': 'application/json'}
data = ("""{
          queries:[  
            {  
              fields:[  
                'title',
                'topic'
              ],
              query:'Livestream'
            },
            {  
              fields:[  
                'channel'
              ],
              query:'ndr'
            }

          ]
    };
""")


response = requests.post(url, headers=headers)

if response.status_code == 200:
    print(json.loads(response.content.decode('utf-8')))
else:
    print(response.status_code, response.text)
The Error Message:

Output:
400 {"result":null,"err":["Unexpected token o in JSON at position 1"]}
Reply


Messages In This Thread
API Query - by Axel_Erfurt - Jan-09-2020, 08:37 PM
RE: API Query - by buran - Jan-10-2020, 03:25 AM
RE: API Query - by snippsat - Jan-10-2020, 05:36 AM
RE: API Query - by buran - Jan-10-2020, 08:24 AM
RE: API Query - by Axel_Erfurt - Jan-10-2020, 10:03 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020