IMDb Title/Trailer Grabber V2

By TehJibba on Mar 08, 2012

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 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:
    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),,%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


Sign in to comment.
Menteroth   -  Sep 23, 2013

this doesn't seem to work, or? I tried with a link like this and won't get any response posted.

Menteroth  -  Sep 23, 2013

the youtube grabber worked though.

TehJibba  -  Oct 10, 2013

Ive just posted my updated code. I had actually updated it a while ago and forgot to post it here. To keep up to date on my projects please visit the website in my profile

Menteroth  -  Oct 10, 2013

Is there any way you can fix so it takes the English title? I live in Sweden and it sends the Swedish title to the channel. I'm guessing it sees the .se from my hostname. Would be much better with English titles.

TehJibba  -  Aug 17, 2014

Sorry for the delayed response i have been in and out of the irc game for a while. Unfortunately the only way around this would be to have the bot located in the us (possibly the uk)

Menteroth  -  Sep 21, 2014

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:

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?

TehJibba  -  Sep 21, 2014

Sure give me a few mins and ill post the updated code. I had actually already done this edit a lil while ago and was gonna update anyways

Menteroth  -  Nov 20, 2014

Thanks for the update.

Menteroth  -  Mar 19, 2015

Doesn't seem to work for me anymore for some reason.
Is there a port that needs to be open or forwarded perhaps? Not sure if it's that, it has worked before.

CrazyDriver  -  Nov 02, 2015

Works for me without a problem, using mIRC v7.43! , except comes up with the alt code versions of & and that.

Menteroth  -  Nov 03, 2015

Youtube thing doesn't work anymore either. Haven't been any links there to try it lately though so haven't seen it earlier.
It's on the Twitch servers, if that helps. If you want to try it out. Using v6.35.

Sign in to comment

zelf0r   -  Mar 24, 2012

nice 1 m8..

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.