free goo.gl script for you linux users

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55679

    #1

    free goo.gl script for you linux users

    Was bored today, this is for you linux users that want to create and decode links using the goo.gl url shortener service.

    Code:
    #!//bin/bash
    
    # goo.gl link creator and decoder
    
    case "$1" in
    create)
    
    if [ $# -ne 2 ] 
    then
     echo "url to shorten needed."
     exit
    fi
    curl -s -d "url=${2}" http://goo.gl/api/url | sed -n "s/.*:\"\([^\"]*\).*/\1/p";
    ;;
    
    decode)
    
    if [ $# -ne 2 ] 
    then
     echo "url to decode needed"
     exit
    fi
    
    check=$(echo $2 | sed -n 's/.*\(http:\/\/goo.gl\/[A-Za-z0-9][A-Za-z0-9]*\).*/\1/p');
    
    if [ -n "$(echo $check)" ]; then 
    curl -sI $2 | sed -n 's/Location:.* //p';
    else
    echo "you must give a valid goo.gl link"
    fi
    ;;
    *)
    
    echo "Usage: `basename $0` {create|decode}" >&2
    exit 64
    ;;
    esac
    also posted it on pastebin

    http://pastebin.com/bx8zYRUV

    enjoy ;)

    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.
  • V_RocKs
    Damn Right I Kiss Ass!
    • Nov 2003
    • 32449

    #2
    Always giving back to the community. Its funny how many detractors a guy can have when he is making things easier for the entire community.

    Comment

    • Barry-xlovecam
      It's 42
      • Jun 2010
      • 18083

      #3
      Works Good

      Code:
      $ ./gooShortURL.sh create [url]http://pastebin.com/bx8zYRUV[/url]
      ./gooShortURL.sh: line 13: curl: command not found
      
      $ sudo apt-get install curl
      [sudo] password 
      
      $ ./gooShortURL.sh create [url]http://pastebin.com/bx8zYRUV[/url]
      [url]http://goo.gl/Nljx[/url]
      $
      Had to install curl

      Try Link

      Comment

      • fris
        Too lazy to set a custom title
        • Aug 2002
        • 55679

        #4
        Originally posted by Barry-xlovecam
        Works Good

        Code:
        $ ./gooShortURL.sh create [url]http://pastebin.com/bx8zYRUV[/url]
        ./gooShortURL.sh: line 13: curl: command not found
        
        $ sudo apt-get install curl
        [sudo] password 
        
        $ ./gooShortURL.sh create [url]http://pastebin.com/bx8zYRUV[/url]
        [url]http://goo.gl/Nljx[/url]
        $
        Had to install curl

        Try Link
        should have added a curl check.

        here is the updated code

        Code:
        #!/bin/bash
        
        # goo.gl link creator and decoder
        
        case "$1" in
        create)
        
        if [ $# -ne 2 ] 
        then
         echo "url to shorten needed."
         exit
        fi
        curl -s -d "url=${2}" http://goo.gl/api/url | sed -n "s/.*:\"\([^\"]*\).*/\1/p";
        ;;
        
        decode)
        
        if [ $# -ne 2 ] 
        then
         echo "url to decode needed"
         exit
        fi
        
        check=$(echo $2 | sed -n 's/.*\(http:\/\/goo.gl\/[A-Za-z0-9][A-Za-z0-9]*\).*/\1/p');
        
        if [ -n "$(echo $check)" ]; then 
        curl -sI $2 | sed -n 's/Location:.* //p';
        else
        echo "you must give a valid goo.gl link"
        fi
        ;;
        *)
        
        if which curl >/dev/null; then 
        
        echo "Usage: `basename $0` {create|decode}" >&2
        
        else 
            echo "curl missing from your system, please install it";
        fi 
        
        exit 64
        ;;
        esac
        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

        Comment

        • signupdamnit
          Confirmed User
          • Aug 2007
          • 6697

          #5
          Nice.

          You don't like my posts? Put me on ignore or fuck right off. I'll say what I want.

          Comment

          • GetSCORECash
            Confirmed User
            • Mar 2008
            • 5527

            #6
            Thanks!!!!
            | skype: getscorecash | ICQ: 59-271-063 |
            New Sites: | SCORELAND2 | Roku Channel SCORETV.TV | 60PLUSMILFS |
            | Big Tit Hooker | Tits And Tugs | Big Boobs POV | Karla James |
            | Naughty Foot Jobs | Linsey's World | Busty Arianna Sinn | Get SCORE Cash |

            Comment

            • bDok
              Confirmed User
              • Feb 2005
              • 1917

              #7
              nice. works of course just fine on os x too. Dropped her in /usr/local/bin/

              thanx.
              http://goo.gl/EQve
              =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
              Warriors come out to plaAAaayyy!
              =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

              Comment

              • fris
                Too lazy to set a custom title
                • Aug 2002
                • 55679

                #8
                Originally posted by bDok
                nice. works of course just fine on os x too. Dropped her in /usr/local/bin/

                thanx.
                http://goo.gl/EQve
                ya figured it would work fine on osx ;)
                Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                Comment

                Working...