256 posts
  • 6 Years of Membership
  • Affiliate Level 4
  • Author Level 8
  • Belgium
+11 more
Sitebase
says

If you are like me and you have your Mac terminal always open than this is a very cool snippet that you can paste in your .bash_profile. Now you can type in envato to get your current Envato balance from within your terminal.

Here you can see a little video of the result: http://www.screenr.com/MuHs

Below is the snippet that you need to past into your .bash_profile file:
envato() {
        username="your_envato_username" 
        apikey="your_envato_apikey" 
        url="http://marketplace.envato.com/api/v2/$username/$apikey/vitals.xml" 

        # Download API result to tmp file
        curl --silent $url > /tmp/envato.xml

        # Get tag value
    echo $ `get_data balance /tmp/envato.xml`

        # Delete temp file
        rm /tmp/envato.xml

}

# Get a specific tag value
get_data () {
    local tag=$1
    local xml=$2
    grep $tag $xml | \
        tr '\011' '\040' | \
        sed -e 's/^[ ]*//' \
            -e 's/^<.*>\([^<].*\)<.*>$/\1/'
}
750 posts
  • Affiliate Level 3
  • Author Level 3
  • Beta Tester
  • Collector Level 2
+7 more
myjilson
says

Great! Also I just shocked by seeing your balance amount :P

by
by
by
by
by
by