r00t-err0r

pic2fb (old-non-working)

Mar 20th, 2012
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.41 KB | None | 0 0
  1. # Command !pic2fb
  2.  
  3. # Usage example: !pic2fb http://a7.sphotos.ak.fbcdn.net/hphotos-ak-snc7/417229_270923126316188_216952361713265_609445_1510413814_n.jpg
  4.  
  5. # Export: Facebook -=> http://www.facebook.com/phone.use.flashlight -=> I use my phone as a flashlight, and hit random buttons to keep it lit | Facebook
  6.  
  7. # Coded by tik-tak & munZe
  8.  
  9. bind pub - !pic2fb pub_fb
  10. bind pub - !title pub_fb
  11.  
  12. package require http
  13.  
  14. proc pub_fb {nick mask hand chan url} {
  15.     if { ![regexp {.+fbcdn.+} $url] } {
  16.     set fburl $url
  17.     set titletxt "Title"
  18.     set page [ ::http::geturl $fburl ]
  19.     set page [ ::http::data [ ::http::geturl $fburl -strict 0 ] ]
  20.     regexp {<title>(.*)</title>} $page match title
  21.     set title [ encoding convertto utf-8 $title]
  22.     } else {
  23.     set id [lindex [split $url _] end-3 ]
  24.         set fbid "http://www.facebook.com/profile.php?id=$id"
  25.     set titletxt "Facebook"
  26.     set page [ ::http::geturl $fbid ]
  27.     set fburl [dict get [array get $page] meta Location]
  28.     set page [ ::http::data [ ::http::geturl $fburl -strict 0 ] ]
  29.     regexp {<title>(.*)</title>} $page match title
  30.     set title [ encoding convertto utf-8 $title]
  31.     set fburl [ encoding convertto utf-8 $fburl] }
  32.  
  33.     if {$title != ""} { puthelp "PRIVMSG $chan \002$titletxt -=>\002 \037$fburl\037 -=> \002$title\002"
  34.     } else { puthelp "PRIVMSG $chan There is some errors with requested link." }
  35.  
  36. }
  37.  
  38.     putlog "Picture 2 Facebook is loaded nad coded by tik-tak & munZe"
Advertisement
Add Comment
Please, Sign In to add comment