Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias -l urlencode { return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2)) }
- alias tvmaze {
- var %u = https://api.tvmaze.com/singlesearch/shows?q= $+ $urlencode($1-)
- var %v = TVMAZE_ $+ $rand(1,1000000000)
- JSONOpen -ud %v %u
- if ($jsonerror) { echo 4 -gate No results founded. - Error Details: $jsonerror | return }
- var %id = $json(%v,id).value
- if (!%id) { echo 4 -gate No results founded. | return }
- var %name = $json(%v,name).value
- var %type = $json(%v,type).value
- var %language = $json(%v,language).value
- var %total_genres = $json(%v,genres).length
- if (%total_genres) { var %i = 0 | while (%i <= %total_genres) { var %genres = $addtok(%genres,$json(%v,genres,%i).value,44) | inc %i } }
- var %network_name = $json(%v,network,name).value
- var %network_couuntry_code = $json(%v,network,country,code).value
- var %self_link = $json(%v,_links,self,href).value
- var %self_previous_episode = $json(%v,_links,previousepisode,href).value
- if (%self_previous_episode) {
- var %vv = TVMAZE2_ $+ $rand(1,100000000)
- JSONOpen -ud %vv %self_previous_episode
- if (!$jsonerror) { var %number = $json(%vv,number).value | var %season = $json(%vv,season).value }
- }
- 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)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement