TV Show Lookup / Parsing JSON Data from URL - 11/02/24 07:50 PM
Hi all,
I'm looking for a working TVMaze Lookup script. Yet, I couldn't find one, so I'm trying to build a small script snippet myself.
A small script that will allow me quickly check some basic data from a given name of a tv show that a) is using TV Maze API and b) does not require any external files.
Here is my code so far:
Example:
When I type /tv american dad it generates the following url https://api.tvmaze.com/singlesearch/shows?q=american+dad
However as far as I can tell my %response is always empty (Null) - and I dont know why and how to fix that.
Who can help please? Thanks in advance!
I'm looking for a working TVMaze Lookup script. Yet, I couldn't find one, so I'm trying to build a small script snippet myself.
A small script that will allow me quickly check some basic data from a given name of a tv show that a) is using TV Maze API and b) does not require any external files.
Here is my code so far:
Code
; Usage: /tv <show_name> alias tv { var %show_name = $replace($1-,$chr(32),+) var %api_url = https://api.tvmaze.com/singlesearch/shows?q= $+ %show_name var %response = $urlget(%api_url) if (%response) { var %show_name = $json(%response,name) var %premiered = $json(%response,premiered) var %status = $json(%response,status) var %summary = $replace($remove($json(%response,summary),<[^>]*>),$chr(10),$chr(32)) var %message = Show: %show_name | Premiered: %premiered | Status: %status | Summary: %summary echo -a %message } else { echo -a Show not found. } }
When I type /tv american dad it generates the following url https:/
However as far as I can tell my %response is always empty (Null) - and I dont know why and how to fix that.
Who can help please? Thanks in advance!