Emule - Emugle Ed2K Search

By FordLawnmower on Sep 06, 2009

Image
This is simple socket script that searches emugle for search results and then returns up to 4 valid ed2k links.
There are multiple triggers for this script. Each trigger corresponds with a search category.
!evid, !emov will search for movies or video.
!eapp, !earc will search for applications or archive files.
!eiso will search for image files (.iso,.nrg,etc)
!eima,!epic,!epho will search for pictures.
!emug will will do a search of all categories.
!ehelp will give basic syntax help.
There is a ! and @ trigger. ! will notice the user and @ will message the channel if the user has halfop or higher.

There is a 10 second timer to prevent flooding. I wouldn't recommend changing this, as this is a very resource intensive script. Each search has to open up to 5 sockets to return the results in the form of a Ed2K link.
For this same reason, it takes 5 to 10 seconds to render the results.
I know Ed2K is almost dead :(((
I should have posted this 2 years ago ;/

;Emugle ed2k link finder by Ford_Lawnmower irc.mindforge.org #USA-Chat
;***
menu Channel,Status {
  .$iif($group(#Emugle) == On,$style(1)) Emugle Trigger
  ..$iif($group(#Emugle) == On,$style(2)) On: .enable #Emugle
  ..$iif($group(#Emugle) == Off,$style(2)) Off: .disable #Emugle
}
#Emugle off
On $*:Text:/^(!|@)e(vid|mov|mus|aud|app|ima|pic|iso|pho|arc|mug|help).*/Si:#: {
  if ($timer($+(Emugle,$network,$nick))) { return }
  .timer $+ $+(Emugle,$network,$nick) 1 10 noop
  var %type $regml(2), %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
  %method Searching Emugle -- I will only do one search for you every 10 seconds so Please be patient!!
  if ($regex(%type,/(vid|mov)/i)) { %type = Video } | if ($regex(%type,/(mus|aud)/i)) { %type = Audio } | if ($regex(%type,/(app|arc)/i)) { %type = Archive }
  if ($regex(%type,/(ima|pic|pho)/i)) { %type = Image } | if (%type == iso) { %type = CD+Image } | if (%type == mug) { %type = All+categories }
  if (!$2) { %method Error No Search items. Emugle triggers are !evideo,!emovie,!emusic,!eaudio,!eapplication,!eimage,!epicture,!eiso,!ephoto,!earchive,!emugle }
  emugleS %method %type $2-
}
#Emugle End
alias -l emugleS {
  var %sockname $+(emugleS,$network,$2,$ticks)
  sockopen %sockname www.emugle.com 80
  sockmark %sockname $1-2 $+(/search.php?q=,$replacex($4-,$chr(32),+),&t=,$3,&f=0&ex=&mins=1&maxs=&avai=&Submit=Search+in+emugle) 0 1
}
alias -l emugleL {
  var %sockname $+(emugleL,$network,$2,$3)
  sockopen %sockname www.emugle.com 80
  sockmark %sockname $1-
}
on *:sockopen:emugle*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.1
    sockwrite -n $sockname Host: www.emugle.com $+ $str($CRLF,2)
  }
  else { echo -st Socket error $nopath($script) }
}
on *:sockread:emugleS*: {
  if ($sockerr) { echo -st Socket error $nopath($script) }
  else {
    var %emugle |  sockread %emugle
    if (No results found in emugle isin %emugle) { $gettok($sock($sockname).mark,1-2,32) No files found! | sockclose $sockname | return }
    if ($regex(%emugle,/<b>Aproximate sources:</b>(.*)sources sharing/)) && ($gettok($regml(1),1,40)) { sockmark $sockname $puttok($sock($sockname).mark,1,4,32) }
    if ($gettok($sock($sockname).mark,4,32)) && (ed2k://|file isin %emugle) {
      sockmark $sockname $puttok($sock($sockname).mark,0,4,32)
      sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,5,32) + 1),5,32)
      emugleL $gettok($sock($sockname).mark,1-2,32) $+(/details.php?f=,$gettok(%emugle,-2,124)) $gettok($sock($sockname).mark,5,32)
    }
    if ($gettok($sock($sockname).mark,5,32) >= 5) { sockclose $sockname | return }
  }
}
On *:sockread:emugleL*: {
  if ($sockerr) { echo -st Socket error $nopath($script) }
  else {
    var %emugleL | sockread %emugleL
    if (<p class="g"> isin %emugleL) { sockmark $sockname $sock($sockname).mark $httpstrip(%emugleL) }
    if (<strong> isin %emugleL) { sockmark $sockname $sock($sockname).mark $httpstrip(%emugleL) }
    if ($between(%emugleL,<a href=',' class="g">,1)) {
      $gettok($sock($sockname).mark,1-2,32) 07E04m06u13g09l07e $remove($gettok($sock($sockname).mark,5-,32),more information:)
      $gettok($sock($sockname).mark,1-2,32) 07E04m06u13g09l07e Link : $+(,$replace($v1,$chr(32),$+(,%,20)))
    }
  }
}
alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) | return %x }
alias -l between { noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi) | return $regml($4) }

Comments

Sign in to comment.
Dark|   -  Dec 05, 2010

Does this work yet?
or no?

 Respond  
HeartbrokenTR   -  Nov 13, 2010

aha okki thnx :)

how about this --> http://figator.org/ 'one' :p

 Respond  
FordLawnmower   -  Nov 13, 2010

@HeartbrokenTR As far as I can tell - http://www.emugle.com/ - Is not working right now.
I am unable to perform searches from my browser so I will have to wait till the site is working to check the script. If they don't get it working in a day or so I will look for a different ed2k search site for this script.

 Respond  
HeartbrokenTR   -  Nov 13, 2010

ech .. this code not working anymore.. :/

 Respond  
FordLawnmower   -  Sep 06, 2009

If there are any die hard emule users left out there, this section of code comes in handy.

on ^$*:Hotlink:/^(ed2k\:\/\/\|.*\|\/)$/Si:#:{
  if ($mouse.key == 16) && ($input(Do you wish to open this Ed2K Link ?,yn)) { run $regml(1) }
  halt
}

This will allow you to right click a ED2K link and open it from the mIRC channel window.
Put this code in your main client.

 Respond  
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.