Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Command !pic2fb
- # Usage example: !pic2fb http://a7.sphotos.ak.fbcdn.net/hphotos-ak-snc7/417229_270923126316188_216952361713265_609445_1510413814_n.jpg
- # 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
- # Coded by tik-tak & munZe
- bind pub - !pic2fb pub_fb
- bind pub - !title pub_fb
- bind pubm - *fbcdn* pub_gfb
- package require http
- proc pub_fb {nick mask hand chan url} {
- regsub {^(?:http://)*} $url {http://} url
- if { ![regexp {.+fbcdn.+} $url] } {
- set fburl $url
- set titletxt "Title"
- set page [ ::http::geturl $fburl ]
- set page [ ::http::data [ ::http::geturl $fburl -strict 0 ] ]
- regexp {<title>(.*)</title>} $page match title
- set title [ encoding convertto utf-8 $title ]
- } else {
- set id [lindex [split $url _] end-3 ]
- set fbid "http://www.facebook.com/profile.php?id=$id"
- set titletxt "Facebook"
- set page [ ::http::geturl $fbid ]
- if { [ dict exists [array get $page] meta Location ] == 1 } {
- set fburl [dict get [array get $page] meta Location]
- set page [ ::http::data [ ::http::geturl $fburl -strict 0 ] ]
- }
- regexp {<title>(.*)</title>} $page match title
- if { [ info exists title ] == 0 } {
- puthelp "PRIVMSG $chan Can't read page title."
- } else {
- set title [ encoding convertto utf-8 $title]
- set fburl [ encoding convertto utf-8 $fburl] }
- puthelp "PRIVMSG $chan \002$titletxt -=>\002 \037$fburl\037 -=> \002$title\002"
- }
- }
- proc pub_gfb {nick mask hand chan url} {
- regsub {^(?:http://)*} $url {http://} url
- if { ![regexp {.+fbcdn.+} $url] } {
- set fburl $url
- set titletxt "Title"
- set page [ ::http::geturl $fburl ]
- set page [ ::http::data [ ::http::geturl $fburl -strict 0 ] ]
- regexp {<title>(.*)</title>} $page match title
- set title [ encoding convertto utf-8 $title]
- } else {
- set id [lindex [split $url _] end-3 ]
- set fbid "http://www.facebook.com/profile.php?id=$id"
- set titletxt "Facebook"
- set page [ ::http::geturl $fbid ]
- if { [ dict exists [array get $page] meta Location ] == 1 } {
- set fburl [dict get [array get $page] meta Location]
- set page [ ::http::data [ ::http::geturl $fburl -strict 0 ] ]
- }
- regexp {<title>(.*)</title>} $page match title
- if { [ info exists title ] == 0 } {
- puthelp "PRIVMSG $chan Can't read page title."
- } else {
- set title [ encoding convertto utf-8 $title]
- set fburl [ encoding convertto utf-8 $fburl] }
- puthelp "PRIVMSG $chan \002$titletxt -=>\002 \037$fburl\037 -=> \002$title\002"
- }
- }
- putlog "Picture 2 Facebook is loaded nad coded by tik-tak & munZe"
Advertisement
Add Comment
Please, Sign In to add comment