So basicly this is based on the same idea as the youtube title grabber i made the other day. It will basicly grab the title and the trailer link to imdb urls posted in the channel.
UPDATE 09/21/2014
Fixed the no trailer bug
UPDATE 10/10/2013
Redid the code a bit and added a halt line to block it on certain networks or chans. Just uncomment th lineee and edit for your neetworks or chans that you dont want it to run in.
;-------------------------------------------;
; IMDb Title/Trailer Grabber ;
;-------------------------------------------;
alias _imdb { var %sockname = imdbsock. $+ $rand(10000,99999) | sockopen %sockname www.imdb.com 80 | sockmark %sockname $1- }
on *:text:*:#: {
if ($regex($strip($1-),/imdb\.com\/title\/([a-z0-9]+)/i)) {
;Uncomment this line and edit to halt the script on certain networks or chans
;if ($network == networktohalt) || ($network == anothernetwork) || ($chan == evenchans) { halt }
_imdb $cid $chan $+(/title/,$regml(1),/)
}
}
on *:sockopen:imdbsock.*: {
if ($sockerr) { /echo -g $gettok($sock($sockname).mark,2,32) Error. | halt }
else {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -nt $sockname Host: www.imdb.com
sockwrite -nt $sockname Content-type: text/html
sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0
sockwrite -nt $sockname Connection: close
sockwrite -nt $sockname $crlf
}
}
on *:sockread:imdbsock.*: {
var %v | sockread %v
if ($regex(%v,/<title>(.*?)</title>/)) { sockmark $sockname $sock($sockname).mark title: $+ $encode($regml(1),m) }
if (($regex(%v,/data-video="([^"]+)"/)) && (*Watch Trailer*</* iswmcs %v)) { sockmark $sockname $sock($sockname).mark trailer: $+ $encode($regml(1),m) }
if (<div id="share-checkin"> isin %v) {
var %title = $remove($decode($gettok($wildtok($sock($sockname).mark, title:*, 1, 32), 2, 58),m), - IMDb)
var %trailer = $decode($gettok($wildtok($sock($sockname).mark, trailer:*, 1, 32), 2, 58),m)
if (%trailer) { var %output = $+($chr(02),$chr(03),01,$chr(44),08,IMDb,$chr(3)) %title $+($chr(02),::,$chr(32),Trailer:,$chr(32),$chr(31),http://www.imdb.com/video/imdb/,%trailer) }
else { var %output = $+($chr(02),$chr(03),01,$chr(44),08,IMDb,$chr(3)) %title $+($chr(02),::,$chr(32),Trailer:,$chr(32),No Trailer Available.) }
scid $gettok($sock($sockname).mark,1, 32) msg $gettok($sock($sockname).mark,2,32) %output
sockclose $sockname
}
}
this doesn't seem to work, or? I tried with a link like this http://www.imdb.com/title/tt1980209 and won't get any response posted.
No problem. Nothing major. Just curious if it was possible.
Came to think of another thing though. When there is no trailer for the movie it looks like this after the title:
(mentbot) The Man from Earth (2007) -- Trailer: http://www.imdb.com/video/imdb/
Any chance you might update the script so it could say "No trailer available" or able to customize the text if there isn't one?
the youtube grabber worked though.