SHOW:
|
|
- or go back to the newest paste.
1 | alias -l urlencode { return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2)) } | |
2 | ||
3 | - | alias imdb { |
3 | + | alias tvmaze { |
4 | - | if ($1) && ($1 == -i) { var -s %u = https://movie-database-imdb-alternative.p.rapidapi.com/?i= $+ $2 $+ &r=json } |
4 | + | |
5 | - | else { var %u = https://movie-database-imdb-alternative.p.rapidapi.com/?t= $+ $urlencode($1-) $+ &r=json } |
5 | + | var %u = https://api.tvmaze.com/singlesearch/shows?q= $+ $urlencode($1-) |
6 | ||
7 | - | var %v = IMDB_ $+ $rand(1,1000000000) |
7 | + | var %v = TVMAZE_ $+ $rand(1,1000000000) |
8 | ||
9 | - | JSONOpen -udw %v %u |
9 | + | JSONOpen -ud %v %u |
10 | ||
11 | - | if ($jsonerror) { echo 4 -gate Error: Connection problem! - Details: $jsonerror | return } |
11 | + | if ($jsonerror) { echo 4 -gate No results founded. - Error Details: $jsonerror | return } |
12 | ||
13 | - | JSONHttpMethod %v GET |
13 | + | var %id = $json(%v,id).value |
14 | - | JSONHttpHeader %v X-RapidAPI-Host movie-database-imdb-alternative.p.rapidapi.com |
14 | + | |
15 | - | JSONHttpHeader %v X-RapidAPI-Key ENTER-API-KEY-HERE |
15 | + | if (!%id) { echo 4 -gate No results founded. | return } |
16 | - | JSONHttpFetch %v |
16 | + | |
17 | var %name = $json(%v,name).value | |
18 | - | var %response = $json(%v,Response).value |
18 | + | var %type = $json(%v,type).value |
19 | - | var %error = $json(%v,Error).value |
19 | + | var %language = $json(%v,language).value |
20 | ||
21 | - | if (%response) && (%error) { echo 4 -gate No results founded. | return } |
21 | + | var %total_genres = $json(%v,genres).length |
22 | if (%total_genres) { var %i = 0 | while (%i <= %total_genres) { var %genres = $addtok(%genres,$json(%v,genres,%i).value,44) | inc %i } } | |
23 | - | var %title = $json(%v,Title).value |
23 | + | |
24 | - | var %year = $json(%v,Year).value |
24 | + | var %network_name = $json(%v,network,name).value |
25 | - | var %language = $json(%v,Language).value |
25 | + | var %network_couuntry_code = $json(%v,network,country,code).value |
26 | - | var %country = $json(%v,Country).value |
26 | + | var %self_link = $json(%v,_links,self,href).value |
27 | - | var %imdbrating = $json(%v,imdbRating).value |
27 | + | var %self_previous_episode = $json(%v,_links,previousepisode,href).value |
28 | - | var %imdbvotes = $json(%v,imdbVotes).value |
28 | + | |
29 | - | var %type = $json(%v,Type).value |
29 | + | if (%self_previous_episode) { |
30 | - | var %boxoffice = $json(%v,BoxOffice).value |
30 | + | var %vv = TVMAZE2_ $+ $rand(1,100000000) |
31 | - | var %imdbid = $json(%v,imdbID).value |
31 | + | |
32 | JSONOpen -ud %vv %self_previous_episode | |
33 | - | echo 3 -gate Title: $iif(%title,$v1,N/A) - Year: $iif(%year,$v1,N/A) - Language: $iif(%language,$v1,N/A) - Country: $iif(%country,$v1,N/A) - IMDB Rating: $iif(%imdbrating,$v1,N/A) - IMDB Votes: $iif(%imdbvotes,$v1,N/A) - Type: $iif(%type,$v1,N/A) - BoxOffice: $iif(%boxoffice,$v1,N/A) - IMDB ID: $iif(%imdbid,$v1,N/A) |
33 | + | |
34 | if (!$jsonerror) { var %number = $json(%vv,number).value | var %season = $json(%vv,season).value } | |
35 | } | |
36 | ||
37 | echo 3 -gate Name: $iif(%name,$v1,N/A) - Type: $iif(%type,$v1,N/A) - Language: $iif(%language,$v1,N/A) - Genres: $iif(%genres,$v1,N/A) - Network Name: $iif(%network_name,$v1,N/A) - Network Country Code: $iif(%network_couuntry_code,$v1,N/A) - Link: $iif(%self_link,$v1,N/A) - Previous Episode: $iif(%self_previous_episode,$v1,N/A) $iif(%number,Number: $v1) $iif(%season,Season: $v1) | |
38 | } |