Picture URL to Facebook Profile [does not working anymore]

By oRtakVeLja on Mar 11, 2012

Convert Facebook URL to Facebook Profile Link and paste Title of the page

Usage command on channel:

!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

or

!title www.hawkee.com

Export: Title -=> http://www.hawkee.com -=> Hawkee Technology Social Network

Script maybe have some errors with grabing name from unauthorised facebook profiles or private profiles, but we working on that ;)

Coded by tik-tak & munZe ($me :))

# Commands:
# !pic2fb <url>
# !title <url>
# 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"

Comments

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.