Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. # created by Yxaaaaaaa ( http://www.egghelp-bg.com )
  2. # http://voting.freeunibg.eu/sugg.html checking
  3.  
  4. package require http
  5.  
  6. namespace eval evoting {
  7.  
  8. ## checking every 10 minutes
  9. bind time - "10 * * * *" [namespace current]::checkvotingtime
  10. bind time - "20 * * * *" [namespace current]::checkvotingtime
  11. bind time - "30 * * * *" [namespace current]::checkvotingtime
  12. bind time - "40 * * * *" [namespace current]::checkvotingtime
  13. bind time - "50 * * * *" [namespace current]::checkvotingtime
  14. bind time - "00 * * * *" [namespace current]::checkvotingtime
  15.  
  16. variable fileVotingDb ./votingDb.txt
  17. variable vchannel #clashr
  18. # don't teach below
  19. # for test purposes:
  20.  
  21. bind pub - !voting [namespace current]::checkvotingch
  22. bind pub - !updatedb [namespace current]::checkvotingtime
  23. proc checkvotingch {n u h c t} {
  24. set token [::http::geturl "http://voting.freeunibg.eu/sugg.html" -timeout 30000]
  25. set data [::http::data $token]
  26. set matches [regexp -nocase -all {<tr>\n<td>\n<a href="sugg-view-(.+?).html">(.+?)<\/a>\n<\/td>\n<td>} $data]
  27. # if { [regexp -all -nocase -- {<tr>\n<td>\n<a href="sugg-view-(.+?).html">(.+?)<\/a>\n<\/td>\n<td>} $data -> webId vote] } {
  28. putquick "PRIVMSG $c :LAST VOTINGS:"
  29. foreach {_ webId vote} $matches {
  30. putquick "PRIVMSG $c :Last voting: $vote -> http://voting.freeunibg.eu/sugg-view-$webId.html"
  31. }
  32. # }
  33. }
  34. proc checkvotingtime {1 2 3 4 5} {
  35. variable fileVotingDb
  36. variable vchannel
  37. set f [open $fileVotingDb r]
  38. set readdata [read -nonewline $f]
  39. close $f
  40. set lastline [lindex [split $readdata "\n"] end]
  41.  
  42. set token [::http::geturl "http://voting.freeunibg.eu/sugg.html" -timeout 30000]
  43. set data [::http::data $token]
  44. if { [regexp -nocase -- {<tr>\n<td>\n<a href="sugg-view-(.+?).html">(.+?)<\/a>\n<\/td>\n<td>} $data -> webId vote] } {
  45. if {$lastline != "http://voting.freeunibg.eu/sugg-view-$webId.html"} {
  46. ## putquick "OPERWALL :IMPORTANT UPDATE -> $vote -> http://voting.freeunibg.eu/sugg-view-$webId.html"
  47. putquick "PRIVMSG $vchannel :IMPORTANT UPDATE -> $vote -> http://voting.freeunibg.eu/sugg-view-$webId.html"
  48. set fileId [open $fileVotingDb "w"]
  49. puts $fileId "http://voting.freeunibg.eu/sugg-view-$webId.html"
  50. close $fileId
  51. }
  52. }
  53. }
  54.  
  55. proc evoting:initial {fileDb} {
  56. if {![file exists $fileDb]} {
  57. set f [open $fileDb "w"]
  58. close $f
  59. }
  60. }
  61. evoting:initial $fileVotingDb
  62. putlog "voting.freeunibg.eu checker by Yxaaaaaaa"
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement