Rotten Tomato Movie Search.
Returns results from rottentomato.com.
Syntax is !trigger movie search terms | @trigger movie search terms
See the top of the script for setup and customization.
;Rotten Tomato Movie info script by Ford_Lawnmower irc.abjects.net #mIRC
alias -l Sets {
;;Do NOT edit the "goto $prop" line below. This will cause the script to FAIL!
goto $prop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Start Setup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Change only the return values below. Do NOT remove the word "return" or any of the ":GotoTags";;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Change the return Below :Logo to change the Logo.
:Logo
return $+($chr(15),$chr(2),$chr(3),08,$chr(44),03R T,$chr(15))
;;Change the return below :TagColor to change the color of the item names. ie Movie name.
:TagColor
return $+($chr(15),$chr(3),04)
;;Change the return below :TextColor to change the color of normal text.
:TextColor
return $+($chr(15),$chr(2))
;;Change the return below :LinkColor to change the color of links.
:LinkColor
return $+($chr(15),$chr(31))
;;Line One two and three can contain any valid items in any order. You may also remove all of
;;the items from any :Line* to prevent it from being displayed. Do NOT remove any of the
;;:Line* Tags.
;;Valid items are as follows; logo, title, year, runtime, release_dates, critics_consensus, genres,
;;mpaa_rating, critics_rating, critics_score, audience_rating, audience_score, cast, directors,
;;synopsis, imdb, link
:LineOne
return logo title year runtime release_dates critics_consensus
:LineTwo
return logo genres mpaa_rating critics_rating critics_score audience_rating audience_score
:LineThree
return logo cast directors synopsis imdb link
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End Setup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Do NOT remove the "}" below!
}
menu Channel,Status {
.$iif($group(#Rotten) == On,$style(1)) Rotten Trigger
..$iif($group(#Rotten) == On,$style(2)) On: .enable #Rotten
..$iif($group(#Rotten) == Off,$style(2)) Off: .disable #Rotten
}
#Rotten on
On $*:Text:/^(\+|-|!|@)(Rotten|tomato|rt).*/Si:#: {
var %action $regml(1)
if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
if (%action == +) {
if ($istok(%RottenChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the Rotten Tomato script }
else {
.enable #Rotten
Set %RottenChanList $addtok(%RottenChanList,$+($network,$chan),32)
.msg $chan $nick has activated the Rotten Tomato script for $chan .
}
}
else {
if (!$istok(%RottenChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the Rotten Tomato script }
else {
Set %RottenChanList $remtok(%RottenChanList,$+($network,$chan),1,32)
.msg $chan $nick has deactivated the Rotten Tomato script for $chan .
}
}
}
elseif (!$timer($+(Rotten,$network,$nick))) && ($istok(%RottenChanList,$+($network,$chan),32)) {
.timer $+ $+(Rotten,$network,$nick) 1 6 noop
var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%|\+)/),.msg $chan,.notice $nick))
GetRotten %method $strip($2-)
}
}
#Rotten end
alias Rotten { GetRotten echo -a $1- }
alias -l GetRotten {
$1-2 Searching $Sets().logo ........
var %sockname $+(GRottenIMDB,$network,$2,$ticks)
sockopen %sockname www.google.com 80
sockmark %sockname $1-2 $+(/search?q=,$replace($3-,$chr(32),+),+site:imdb.com&rls=en&hl=en) $3-
}
On *:sockopen:GRottenIMDB*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: www.google.com
sockwrite -n $sockname User-Agent: Opera 9.6
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | hfree $sockname | sockclose $sockname }
}
On *:sockread:GRottenIMDB*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | hfree $sockname | sockclose $sockname }
else {
sockread &GRottenIMDB
if ($bintween(&GRottenIMDB,<cite>www.imdb.com/title/tt,/</cite>,1)) {
var %sockname $+(Rotten,$sockname), %method $gettok($sock($sockname).mark,1-2,32), %search $gettok($sock($sockname).mark,4-,32)
sockclose $sockname
sockopen %sockname api.rottentomatoes.com 80
sockmark %sockname %method $+(/api/public/v1.0/movie_alias.json?,$pack(1,`qhjdx<subiqw43t2wlsr586ty364`o),&type=imdb&id=,$v1) %search
return
}
elseif ($bintween(&GRottenIMDB,Your search,</b> - did not match any documents.,1)) {
$gettok($sock($sockname).mark,1-2,32) Sorry - Cannot find $gettok($sock($sockname).mark,4-,32)
sockclose $sockname
return
}
}
}
On *:sockclose:GRottenIMDB*: { $gettok($sock($sockname).mark,1-2,32) Sorry - Cannot find $gettok($sock($sockname).mark,4-,32) }
On *:sockopen:Rotten*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: api.rottentomatoes.com
sockwrite -n $sockname User-Agent: Opera 9.6
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:Rotten*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %Rotten | sockread %Rotten
if ($regex(%Rotten,/"total":(.*?)\x2c.*?"id":"(.*?)"/)) {
if ($regml(1)) {
var %sockname $sockname, %method $gettok($sock($sockname).mark,1-2,32)
sockclose $sockname
sockopen %sockname api.rottentomatoes.com 80
sockmark %sockname %method $+(/api/public/v1.0/movies/,$regml(2),.json?,$pack(1,`qhjdx<subiqw43t2wlsr586ty364`o))
}
else {
$gettok($sock($sockname).mark,1-2,32) $Sets().Logo $Sets().TextColor Sorry, No results found for your search.
sockclose $sockname
return
}
}
if ("total":0, isin %Rotten) {
$gettok($sock($sockname).mark,1-2,32) $Sets().Logo $Sets().TextColor Sorry, No results found for your Search.
sockclose $sockname
return
}
if ("error":"Could not find a movie with the specified id" isin %Rotten) {
tokenize 32 $sockname $sock($sockname).mark
sockclose $sockname
sockopen $1 api.rottentomatoes.com 80
sockmark $1 $2-3 $+(/api/public/v1.0/movies.json?,$pack(1,`qhjdx<subiqw43t2wlsr586ty364`o),&q=,$replace($5-,$chr(32),+),&page_limit=1&page=1)
}
if ($regex(%Rotten,/"synopsis":"(.*?)"\x2c/)) {
if ($regml(1)) var %synopsis $+($Sets().TagColor,Synopsis) $+($Sets().TextColor,$regml(1))
}
if ($regex(%Rotten,/"critics_rating":"(.*?)"\x2c"/)) {
if ($regml(1)) var %critics_rating $+($Sets().TagColor,Critics rating) $+($Sets().TextColor,$regml(1))
}
if ($regex(%Rotten,/"mpaa_rating":"(.*?)"\x2c"/)) {
if ($regml(1)) var %mpaa_rating $+($Sets().TagColor,Mpaa rating) $+($Sets().TextColor,$regml(1))
}
if ($regex(%Rotten,/"genres":\x5b(.*?)\x5d\x2c"/)) {
if ($regml(1)) var %genres $+($Sets().TagColor,Genres) $+($Sets().TextColor,$regml(1))
}
if ($regex(%Rotten,/"critics_consensus":"(.*?)"\x2c"/)) {
if ($regml(1)) var %critics_consensus $+($Sets().TagColor,Critics consensus) $+($Sets().TextColor,$regml(1))
}
if ($regex(%Rotten,/"release_dates":\x7b(.*?)\x7d\x2c/i)) {
if ($regml(1)) var %release_dates $+($Sets().TagColor,Release dates) $+($Sets().TextColor,$regml(1))
}
if ($regex(%Rotten,/"(id|title|year|runtime|critics_score|audience_rating|audience_score)":(.*?)\x2c/g)) {
var %count $regml(0)
while (%count > 0) {
var % $+ $regml($calc(%count - 1)) $+($Sets().TagColor,$u_($regml($calc(%count - 1)))) $+($Sets().TextColor,$remove($regml(%count),$chr(125)))
dec %count 2
}
var %link $+($Sets().TagColor,Link) $+($Sets().LinkColor,http://www.rottentomatoes.com/m/,$remove($strip(%id),id,$chr(32)),/,$chr(15))
var %logo $Sets().Logo
}
if ($regex(actors,%Rotten,/"name":"(.*?)"/ig)) {
var %cast $+($Sets().TagColor,Cast) $+($Sets().TextColor,$regsubex($str(.,$regml(actors,0)),/(.)/g,$+($chr(32),$qt($regml(actors,\n)))))
}
if ($regex(%Rotten,/"abridged_directors":\x5b\x7b(.*?)\x7d\x5d/)) {
var %directors $+($Sets().TagColor,Directors) $+($Sets().TextColor,$replace($remove($regml(1),$chr(123),$chr(125)),"name":,$chr(32)))
}
if ($regex(%Rotten,/"imdb":"(.*?)"/)) var %imdb $+($Sets().TagColor,imdb) $+($Sets().LinkColor,http://www.imdb.com/title/tt,$regml(1),/,$chr(15))
if (?"id":* iswm %Rotten) {
if ($Sets().LineOne) put $gettok($sock($sockname).mark,1-2,32) $Sets().TextColor $regsubex($v1,/([\S]+)/g,$($+(%,\t),2))
if ($Sets().LineTwo) put $gettok($sock($sockname).mark,1-2,32) $Sets().TextColor $regsubex($v1,/([\S]+)/g,$($+(%,\t),2))
if ($Sets().LineThree) put $gettok($sock($sockname).mark,1-2,32) $Sets().TextColor $regsubex($v1,/([\S]+)/g,$($+(%,\t),2))
}
}
}
alias -l Put {
if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text | return }
tokenize 32 $regsubex($1-,/([$\|%\[\]][^\s]*)/g,$+($chr(2),$chr(2),\t))
var %tokens $0, %Tstart 4, %Dtimer 1500
if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }
while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
dec %tokens
if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
.timer -m 1 %Dtimer $1-2 $Sets().TextColor $($+($,%Tstart,-,%tokens),2))
inc %Dtimer 1500
%Tstart = $calc(%tokens + 1)
%tokens = $0
}
}
.timer -m 1 %Dtimer $1-2 $Sets().TextColor $($+($,%Tstart,-,%tokens),2))
.timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
}
alias -l bintween {
var %count = 1, %mark = 0, %mark2 = 0
while (%count <= $4) {
if ($bfind($1, %mark2, $2).text) {
%mark = $calc($bfind($1, %mark2, $2).text + $len($2))
if ($bfind($1, %mark, $3).text) {
%mark2 = $bfind($1, %mark, $3).text
}
else { return 0 }
}
else { return 0 }
inc %count
}
return $bvar($1, $iif(%mark > 0,%mark,1), $calc(%mark2 - %mark)).text
}
alias -l u_ return $regsubex(u,$replace($1-,_,$chr(32)),/(\w)/,$upper(\t)),_,$chr(32)
alias -l pack {
var %up $1
return $regsubex($2-,/(.)/g,$chr($xor(%up,$asc(\t))))
}
I can find no issues with this script:
[14:11:58] <@Ford_Lawnmower> +rt
[14:11:58] Ford_Lawnmower has activated the Rotten Tomato script for #FordIRC .
[14:12:12] <@Ford_Lawnmower> @rt god bless america
[14:12:12] Searching R T ........
[14:12:14] R T Title "God Bless America" Year 2012 Runtime 104 Release dates "theater":"2012-05-11","dvd":"2012-07-03" Critics consensus A darkly comic polemic on modern culture, God Bless America is uneven and somewhat this but the ideas behind this revenge fulfillment journey has primal appeal.
[14:12:16] R T Genres "Drama","Comedy" Mpaa rating R Critics rating Fresh Critics score 65 Audience rating "Upright" Audience score 75
[14:12:17] R T Cast "Joel Murray" "Tara Lynne Barr" "Melinda Page Hamilton" "Geoff Peirson" "Mackenzie Brooke Smith" "Bobcat Goldthwait" Directors "Bobcat Goldthwait" Synopsis Frank (Joel Murray) has had enough of the downward spiral of American culture. Divorced, recently fired, and possibly terminally ill, Frank truly has nothing left to live for. But instead of taking
[14:12:17] his own life, he buys a gun and
[14:12:20] decides to take out his frustration on the cruelest, stupidest, most intolerant people he can imagine -- starting with some particularly odious reality television stars. Frank finds an unusual accomplice in a high-school student named Roxy (Tara Lynne Barr), who shares his sense of rage and disenfranchisement. Together they embark on a nationwide assault on our country's most irritating
[14:12:25] celebrities. -- (C) Magnet Releasing
[14:12:25] imdb http://www.imdb.com/title/tt1912398/ Link http://www.rottentomatoes.com/m/771253753/
@yellow79 To use the triggers , turn the "Rotten Trigger" ON and type +rt in each channel you want to run the script.
This must be done with a second client that has Ops.
Sorry , I forgot to add this to the description.
Channel Control:
Yeah, their API is not free anymore. It will work if you're willing to pay for a key.
Otherwise, you now need to parse their html.