egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

get video title from vbox7.com

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
veso
Voice


Joined: 13 Jun 2011
Posts: 3

PostPosted: Sun Jul 17, 2011 3:29 pm    Post subject: get video title from vbox7.com Reply with quote

Can any 1 help me with this tcl i write this code but i cant get the video title Sad

Code:
bind pubm - * rss-chckurl
proc rss-chckurl {n u h c t} {
set zazz {http://vbox7.*/play:([A-Za-z0-9_\-]+)}
if {[regexp $zazz $t match fluff video_id]} {
      set url "$match"
      szazz $url $c
      }
}


proc szazz {url c {refer ""} {cookies ""} { re 0 }} {
http::config -useragent "Opera/9.80 (Windows NT 5.1; U; bg) Presto/2.6.30 Version/10.62"
   # if we have cookies, let's use em ;)
   if {![string length $cookies]} {
      catch {set token [http::geturl $url -timeout 10000]} error
   } else {
      catch {set token [::http::geturl $url -headers [list "Referer" "$refer" "Cookie" "[string trim [join $cookies {;}] {;}]" ] -timeout 10000]} error
   }
   # error condition 1, invalid socket or other general error
   if {![string match -nocase "::http::*" $error]} {
      putlog "Error: [string totitle [string map {"\n" " | "} $error]] \( $url \)"
      return 0
   }
   # error condition 2, http error
   if {![string equal -nocase [::http::status $token] "ok"]} {
      putlog "Http error: [string totitle [::http::status $token]] \( $url \)"
      http::cleanup $token
      return 0
   }
   upvar #0 $token state
   # iterate through the meta array to grab cookies
   foreach {name value} $state(meta) {
      # do we have cookies?                                                           
         if {[regexp -nocase ^Set-Cookie$ $name]} {
         # yes, add them to cookie list                                                       
         lappend ourCookies [lindex [split $value {;}] 0]
      }
   }
   # if no cookies this iteration remember cookies from last
   if {![info exists ourCookies] && [string length $cookies]} {
      set ourCookies $cookies
   }
   # recursive redirect support, 300's
   # the full gambit of browser support, hopefully ... ;)
   if {[string match "*[http::ncode $token]*" "303|302|301" ]} {
      foreach {name value} $state(meta) {
         if {[regexp -nocase ^location$ $name]} {
            if {![string match "http*" $value]} {
               # fix our locations if needed
               if {![string match "/" [string index $value 0]]} {
                  set value "[join [lrange [split $url "/"] 0 2] "/"]/$value"
              putlog "$value"
               } else {
                  set value "[join [lrange [split $url "/"] 0 2] "/"]$value"
              putlog "$value"
               }
            }
            # catch redirect to self's. There is one rule:
            # A url can redirect to itself a few times to attempt to
            # gain proper cookies, or referers. This is hard-coded at 2.
            # We catch the 3rd time and poison our recursion with it.
            # This will stop the madness ;)
            if {[string match [string map {" " "%20"} $value] $url]} {
               if {![info exists poison]} {
                  set poison 1
               } else {
                  incr poison
                  if {$poison > 2} {
                    putlog "HTTP Error: Redirect error self to self \(3rd instance poisoned\) \( $url \)"
                    return
                  }
               }
            }
            # poison any nested recursion over 10 traversals deep. no legitimate
            # site needs to do this. EVER!
            if {[incr re] > 10} {
              putlog "HTTP Error: Redirect error (>10 too deep) \( $url \)"
              return
            }
            # recursive redirect by passing cookies and referer
            # this is what makes it now work! :)
            szazz [string map {" " "%20"} $value] $url $c $ourCookies $re
            # only the last iteration from our recursion is required
            # we save time by using return on prior recurses. this does
            # not poison the recursion because we have invoked ourself
            # before we poison the unneeded iteration.
            return
         }
      }
   }
   # waaay down here, we finally check the ncode for 400 or 500 codes
   if {[string match 4* [http::ncode $token]] || [string match 5* [http::ncode $token]]} {
      putlog "Http resource is not evailable: [http::ncode $token] \( $url \)"
      return 0
   }
      set html [split [::http::data $token] \n]
      #regsub -all "\n" $html "" html
      set f [open z.db w]
      puts $f $html
      close $f
#      if {[regexp {<title>(.*?)</title>} $html - title]} { putquick "privmsg $c : $title" }
#      ::http::cleanup $token
}


when i post the video link my bot retturn this:
http://vbox7.com/show:missjavascript?back_to=%2Fplay%3A9b3eb2dc
http://vbox7.com/show:misscookie?back_to=%2Fplay%3A9b3eb2dc
http://vbox7.com/show:missjavascript?back_to=%2Fplay%3A9b3eb2dc
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber