PreDB.org mIRC Announcer v0.5

By OrFeAsGr on Feb 24, 2017

Credits to Wikked for the idea.
;;; Scripts by OrFeAsGr mirc-land.tk Support my art work: http://orpheusgr.tk ;;;
;; v0.5 05/02/2018 ;;;
;;; Code updated because of the site source code being changed ;;;
;;; No new features ;;;
Commands:
!predb
Turn on/off the announcing of new posts
!predbrecent N
Sends the N most recent posts. If no number is given it sends the last 20
!presearch N search
Sends the results from the N page for your search
N can be a number from 1 to 10

Input your channel(s) under alias predbch { where it says: YOUR_CHAN(s)_HERE . Seperate multiple channels with a comma.
Then go to the channel or one of the channels you wrote and type !predb
This command will turn on/off the checking timer.

Tips:

  1. A way for the command to be used only from nicks you allow to is to add a channel but make it invite only (+i channel mode) so only the people you want can use the command :) i could add a list of nicks but i'm bored :X
  2. You can change the order of the release info or add colours. Just don't stick colour codes onto the variables, they won't be evaluated.
    Good Luck! Have Fun! Please don't remove the adv message.. it won't be sent frequently
;;; Scripts by OrFeAsGr mirc-land.tk Support my art work: http://orpheusgr.tk ;;;
;; v0.5 05/02/2018 ;;;
;;; Code updated because of the site source code being changed ;;;
;;; No new features ;;;
on *:TEXT:*:#:{
  if (!predb == $1) {
    if ($timer(predb).secs) {
      .timerpredb off
      .msg $predbch Pre Announce Stopped.
    }
    elseif (!$timer(predb).secs) {
      .timer 1 3 sockopen -e predb predb.org 443
      .timerpredb 0 60 sockopen -e predb predb.org 443
      .msg $predbch Pre Announce Started.
    }
  }
  if (!presearch == $1) {
    unset %predbsearch
    if ($3) {
      set %predbsearch.q $3-
      if ($2 isnum 1-10) {
        set %predbsearch.page $2
      }
      elseif ($2 !isnum 1-10) { msg $chan USAGE: !presearch <page>  <search term>  (page can be a number from 1 to 10) | return }
      sockopen -e predbsearch predb.org 443
      set %predbsearch.chan $chan
      msg $chan Type !prestop to stop the results.
    }
    elseif (!$3) { msg $chan USAGE: !presearch <page>  <search term>  (page can be a number from 1 to 10) }
  }
  if (!prestop == $1) { 
    .timerpredbsearch* off
    endpredb
  }
  if (!predbrecent == $1) {
    set %predbrecent.num $iif($2 isnum, $v1, 20)
    sockopen -e predbrecent predb.org 443
    set %predbrecent.chan $chan
  }
}

on *:SOCKOPEN:predb: {
  sockwrite -nt $sockname GET / HTTP/1.1
  sockwrite -nt $sockname Host: predb.org
  sockwrite $sockname $crlf
}

on *:SOCKOPEN:predbsearch: {
  sockwrite -nt $sockname GET $+(/search/,%predbsearch.q,/all,$iif(%predbsearch.page, $+(/page/,$v1), $null)) HTTP/1.1
  sockwrite -nt $sockname Host: predb.org
  sockwrite $sockname $crlf
}

on *:SOCKOPEN:predbrecent: {
  sockwrite -nt $sockname GET / HTTP/1.1
  sockwrite -nt $sockname Host: predb.org
  sockwrite $sockname $crlf
}

on *:SOCKREAD:predb: {
  var %predb
  sockread %predb
  if (*tr class="post" id=* iswm %predb) {
    var %id = $gettok(%predb,4,34)
    if (!%predblastid) || (%predblastid != %id) { set %predblastid %id | set %pridfound 1 }
    elseif (%predblastid == %id) { sockclose $sockname }
    ;;; %predblastid is not a typo. the dot is missing on purpose :) ;;;
  }
  if (%pridfound) && (*td>*</td* iswm %predb) { unset %pridfound | set %predb.time $gettok($gettok(%predb,2,62),1,60) }
  if (*href="/cats* iswm %predb) { set %predb.catl $+(www.predb.org,$gettok(%predb,2,34)) | set %predb.cat $gettok(%predb,6,34) }
  if (*a href="/group/* iswm %predb) { set %predb.grpl $+(www.predb.org,$gettok(%predb,2,34)) | set %predb.grp $gettok(%predb,6,34) }
  if (*a href="/post/* iswm %predb) { 
    set %predb.rls $gettok(%predb,6,34)
    sockclose $sockname
    msg $predbch %predb.time Ago. Category: %predb.catl %predb.cat Group: %predb.grpl %predb.grp Title: %predb.rls
    inc %counterpredb
    if (%counterpredb == 5000) { .timer 1 5 msg $predbch Predb.org mIRC Announcer Scripted by OrFeAsGr! mIRC Scripts & More: http://mirc-land.tk - My art work: http://orpheusgr.tk | unset %counterpredb }
    unset %predb.*
  }
}

on *:SOCKREAD:predbsearch: {
  var %predb
  sockread %predb
  if (*tr class="post" id=* iswm %predb) { set %pridfound 1 | set %predbsearch.id $gettok(%predb,4,34) }
  if (%pridfound) && (*td>*</td* iswm %predb) { unset %pridfound | set %predbsearch.time $gettok($gettok(%predb,2,62),1,60) }
  if (*href="/cats* iswm %predb) { set %predbsearch.catl $+(www.predb.org,$gettok(%predb,2,34)) | set %predbsearch.cat $gettok(%predb,6,34) }
  if (*a href="/group/* iswm %predb) { set %predbsearch.grpl $+(www.predb.org,$gettok(%predb,2,34)) | set %predbsearch.grp $gettok(%predb,6,34) }
  if (*a href="/post/* iswm %predb) { 
    .timerendpredb off
    set %predbsearch.rls $gettok(%predb,6,34)
    inc %predbsearch.resc 2
    $+(.timerpredbsearch,%predbsearch.resc) 1 %predbsearch.resc msg %predbsearch.chan %predbsearch.time Ago. Category: %predbsearch.catl %predbsearch.cat Group: %predbsearch.grpl %predbsearch.grp Title: %predbsearch.rls $+(https://predb.org/post/,%predbsearch.id,/)
    .timerendpredb 1 5 endpredb
  }
}

on *:SOCKREAD:predbrecent: {
  var %predb
  sockread %predb
  echo -at %predb
  if (*tr class="post" id=* iswm %predb) { set %pridfound 1 | set %predbrecent.id $gettok(%predb,4,34) }
  if (%pridfound) && (*td>*</td* iswm %predb) { unset %pridfound | set %predbrecent.time $gettok($gettok(%predb,2,62),1,60) }
  if (*href="/cats* iswm %predb) { set %predbrecent.catl $+(www.predb.org,$gettok(%predb,2,34)) | set %predbrecent.cat $gettok(%predb,6,34) }
  if (*a href="/group/* iswm %predb) { set %predbrecent.grpl $+(www.predb.org,$gettok(%predb,2,34)) | set %predbrecent.grp $gettok(%predb,6,34) }
  if (*a href="/post/* iswm %predb) { 
    .timerendpredb off
    set %predbrecent.rls $gettok(%predb,6,34)
    inc %predbrecent.resc 2
    $+(.timerpredbrecent,%predbrecent.resc) 1 %predbrecent.resc msg %predbrecent.chan %predbrecent.time Ago. Category: %predbrecent.catl %predbrecent.cat Group: %predbrecent.grpl %predbrecent.grp Title: %predbrecent.rls $+(https://predb.org/post/,%predbrecent.id,/)
    if ($calc(%predbrecent.resc / 2) == %predbrecent.num) { .timerendpredbrecent off | endpredbrecent }
    .timerendpredbrecent 1 5 endpredbrecent
  }
}

alias predbch { 
  return YOUR_CHANNEL_HERE
  ;;seperate multiple channels with a comma -> , (e.g #Home,#chat,#cafe)
}

alias endpredb { sockclose predbsearch | unset %predbsearch.* }
alias endpredbrecent { sockclose predbrecent | unset %predbrecent.* }

;;; Scipted by OrFeAsGr http://mirc-land.tk - Support my art work: http://orpheusgr.tk ;;;

Comments

Sign in to comment.
ovelayer   -  Mar 07, 2018

stopped working

fastjoy77  -  Mar 16, 2018

died

OrFeAsGr  -  Mar 17, 2018

Hey guys thx for using the script, i fixed it and posted it on my site because it's easier for me.
http://humanity.ucoz.com/forum/3-12-1
I didn't update the code here in Hawkee and i probably won't. So if you want you can register over on my site to report/request stuff

Sign in to comment

ovelayer   -  Apr 15, 2017

hey OrFeAsGr awsome script!
was wondering if you could add acouple things??
a command of !pre that will display 20 of the most recent pre's
and !nuked which witll display 20 of the most recent nuked releases
this would be a very good addition to this script
thanks for you hard work and staying involved!!

edit:
i guess predb doesnt show a nuked release but the other command would still be good.
;)

fastjoy77  -  May 05, 2017

search not work

:(

Sign in to comment

fastjoy77   -  Feb 28, 2017

Work 100%
it would be nice if it also makes the search for release

OrFeAsGr  -  Feb 28, 2017

Hi! Do you mean search through that list for a specific release or search for that title elsewhere???

fastjoy77  -  Mar 01, 2017

search a specific release

http://hawkee.com/snippet/9660/

OrFeAsGr  -  Mar 03, 2017

Hey man, i added a search command! Check it out!

fastjoy77  -  Mar 11, 2017

it's possible add double search?

type : !pre xvid english

OrFeAsGr  -  Mar 12, 2017

yeah it is, i'll add it out soon

fastjoy77  -  Mar 16, 2017

search no works :(

fastjoy77  -  Mar 28, 2017

OrFeAsGr search dont' work

Sign in to comment

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.