Skip to content

Instantly share code, notes, and snippets.

@hackruu
Last active February 24, 2025 18:11
Show Gist options
  • Save hackruu/6fc318e677b899f99751 to your computer and use it in GitHub Desktop.
Save hackruu/6fc318e677b899f99751 to your computer and use it in GitHub Desktop.

Revisions

  1. hackruu revised this gist Mar 10, 2017. 1 changed file with 9 additions and 14 deletions.
    23 changes: 9 additions & 14 deletions di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -56,27 +56,22 @@ curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST 'https://api.audioaddict

    rndsleep

    # login
    json=$(curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audioaddict.com/v1/di/members/authenticate" --user-agent "$AGENT" \
    --data-urlencode "username=$login@$DOMAIN" --data-urlencode "password=$pass")
    # get csrf-token
    csrf_token=$(curl -s --request GET "https://www.di.fm/login" | awk -F'<input name="authenticity_token" type="hidden" value="' '{ print $2 }' | awk -F'"' '{ print $1 }'| sed '/^$/d')

    rndsleep

    # set envs
    api_key=$(echo "$json" | jshon -e api_key -u)
    id=$(echo "$json" | jshon -e id -u)

    rndsleep

    # check premium avail for this acct.
    curl -b $COOKIES -c $COOKIES -s -u $AUTH --request GET "https://api.audioaddict.com/v1/di/members/$id/subscriptions/trial_allowed/premium-pass?api_key=$api_key" \
    --user-agent "$AGENT" >/dev/null
    # login
    curl -c $COOKIES -s --request POST "https://www.di.fm/login" --user-agent "$AGENT" \
    --data "utf8=%E2%9C%93" --data-urlencode "authenticity_token=$csrf_token" \
    --data-urlencode "member_session[username]=$login@$DOMAIN" --data-urlencode "member_session[password]=$pass" \
    --data-urlencode "member_session[remember_me]=0" >/dev/null

    rndsleep

    # subscribe to 7 day premium trial
    curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audioaddict.com/v1/di/members/$id/subscriptions/trial/premium-pass" \
    --user-agent "$AGENT" --data-urlencode "api_key=$api_key" >/dev/null
    curl -b $COOKIES -c $COOKIES -s --request GET "http://www.di.fm/member/premium/trial/activate" \
    --user-agent "$AGENT" >/dev/null

    rndsleep

  2. hackruu revised this gist Jan 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -75,7 +75,7 @@ curl -b $COOKIES -c $COOKIES -s -u $AUTH --request GET "https://api.audioaddict.
    rndsleep

    # subscribe to 7 day premium trial
    curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audioaddict.com/v1/di/members/8948397/subscriptions/trial/premium-pass" \
    curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audioaddict.com/v1/di/members/$id/subscriptions/trial/premium-pass" \
    --user-agent "$AGENT" --data-urlencode "api_key=$api_key" >/dev/null

    rndsleep
  3. hackruu revised this gist Nov 18, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,12 @@ PLAYLISTDI="di.fm.m3u"
    PLAYLISTSKY="sky.fm.m3u"
    PLAYLISTJAZZ="jazzradio.m3u"
    PLAYLISTROCK="rockradio.m3u"
    PLAYLISTCLASSICAL="classicalradio.m3u"
    JSONDI="http://listen.di.fm/premium_high.json"
    JSONSKY="http://listen.sky.fm/premium_high.json"
    JSONJAZZ="http://listen.jazzradio.com/premium_high.json"
    JSONROCK="http://listen.rockradio.com/premium_high.json"
    JSONCLASSICAL="http://listen.classicalradio.com/premium_high.json"

    function rndsleep()
    {
    @@ -100,3 +102,4 @@ playlist "$PLAYLISTDI" "$JSONDI" di.fm
    playlist "$PLAYLISTSKY" "$JSONSKY" sky.fm
    playlist "$PLAYLISTJAZZ" "$JSONJAZZ" jazzradio.com
    playlist "$PLAYLISTROCK" "$JSONROCK" rockradio.com
    playlist "$PLAYLISTCLASSICAL" "$JSONCLASSICAL" classicalradio.com
  4. hackruu revised this gist Dec 2, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -21,15 +21,15 @@ function playlist()
    {
    playlistfile="$1"
    jsonurl="$2"
    radioname="$3"
    radioname="$3"
    echo "#EXTM3U" > "$playlistfile"
    json=$(curl -s "$jsonurl")
    num=$(echo "$json" | jshon -l)
    for i in $(seq 0 $num); do
    name=$(echo $json | jshon -e $i -e name -u)
    playlist=$(echo $json | jshon -e $i -e playlist -u)
    echo "#EXTINF:0, $name" >> "$playlistfile"
    echo $playlist?$listen_key >> "$playlistfile"
    echo $playlist?$listen_key >> "$playlistfile"
    done
    echo "$radioname" playlist written to "$playlistfile"
    }
  5. hackruu revised this gist Jul 24, 2015. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,15 @@
    AGENT="AudioAddict-di/1.4.7 iOS/8.1"
    COOKIES="./cookies.txt"
    AUTH="ephemeron:dayeiph0ne@pp"
    DOMAIN=discard.email
    DOMAIN=gmail.com
    PLAYLISTDI="di.fm.m3u"
    PLAYLISTSKY="sky.fm.m3u"
    PLAYLISTJAZZ="jazz.fm.m3u"
    PLAYLISTJAZZ="jazzradio.m3u"
    PLAYLISTROCK="rockradio.m3u"
    JSONDI="http://listen.di.fm/premium_high.json"
    JSONSKY="http://listen.sky.fm/premium_high.json"
    JSONJAZZ="http://listen.jazzradio.com/premium_high.json"
    JSONROCK="http://listen.rockradio.com/premium_high.json"

    function rndsleep()
    {
    @@ -97,3 +99,4 @@ echo "password $pass"
    playlist "$PLAYLISTDI" "$JSONDI" di.fm
    playlist "$PLAYLISTSKY" "$JSONSKY" sky.fm
    playlist "$PLAYLISTJAZZ" "$JSONJAZZ" jazzradio.com
    playlist "$PLAYLISTROCK" "$JSONROCK" rockradio.com
  6. hackruu revised this gist Mar 23, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,10 @@ function playlist()
    # check for jshon
    which jshon >/dev/null || (echo "install jshon first"; exit 1) || exit 1
    # check for pwgen
    which jshon >/dev/null || (echo "install pwgen first"; exit 1) || exit 1
    which pwgen >/dev/null || (echo "install pwgen first"; exit 1) || exit 1
    # check for curl
    which curl >/dev/null || (echo "install curl first"; exit 1) || exit 1


    # generate identity and password
    login=$(pwgen -0 $[ ( $RANDOM % 2 ) + 6 ] 1 | tr [A-Z] [a-z])
  7. hackruu revised this gist Mar 23, 2015. 1 changed file with 33 additions and 7 deletions.
    40 changes: 33 additions & 7 deletions di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,35 @@
    #!/bin/bash
    #(c) 2015 hackru
    AGENT="AudioAddict-di/1.4.7 iOS/8.1"
    COOKIES="./cookies.txt"
    AUTH="ephemeron:dayeiph0ne@pp"
    DOMAIN=discard.email
    PLAYLISTDI="di.fm.m3u"
    PLAYLISTSKY="sky.fm.m3u"
    PLAYLISTJAZZ="jazz.fm.m3u"
    JSONDI="http://listen.di.fm/premium_high.json"
    JSONSKY="http://listen.sky.fm/premium_high.json"
    JSONJAZZ="http://listen.jazzradio.com/premium_high.json"

    function rndsleep()
    {
    sleep .$[ ( $RANDOM % 4 ) + 1 ]s
    sleep .$[ ( $RANDOM % 4 ) + 1 ]s
    }

    function playlist()
    {
    playlistfile="$1"
    jsonurl="$2"
    radioname="$3"
    echo "#EXTM3U" > "$playlistfile"
    json=$(curl -s "$jsonurl")
    num=$(echo "$json" | jshon -l)
    for i in $(seq 0 $num); do
    name=$(echo $json | jshon -e $i -e name -u)
    playlist=$(echo $json | jshon -e $i -e playlist -u)
    echo "#EXTINF:0, $name" >> "$playlistfile"
    echo $playlist?$listen_key >> "$playlistfile"
    done
    echo "$radioname" playlist written to "$playlistfile"
    }

    # check for jshon
    @@ -34,9 +56,8 @@ json=$(curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audi
    rndsleep

    # set envs
    api_key=$(echo "$json" | jshon -e api_key | tr -d '"')
    listen_key=$(echo "$json" | jshon -e listen_key | tr -d '"')
    id=$(echo "$json" | jshon -e id)
    api_key=$(echo "$json" | jshon -e api_key -u)
    id=$(echo "$json" | jshon -e id -u)

    rndsleep

    @@ -57,8 +78,8 @@ json=$(curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audi
    --data-urlencode "username=$login@$DOMAIN" --data-urlencode "password=$pass")

    # set envs
    api_key=$(echo "$json" | jshon -e api_key | tr -d '"')
    listen_key=$(echo "$json" | jshon -e listen_key | tr -d '"')
    api_key=$(echo "$json" | jshon -e api_key -u)
    listen_key=$(echo "$json" | jshon -e listen_key -u)
    id=$(echo "$json" | jshon -e id)
    activated=$(echo "$json" | jshon -e activated)

    @@ -68,3 +89,8 @@ echo "api_key $api_key"
    echo "id $id"
    echo "login $login@$DOMAIN"
    echo "password $pass"

    # comment out these if you don't need playlists
    playlist "$PLAYLISTDI" "$JSONDI" di.fm
    playlist "$PLAYLISTSKY" "$JSONSKY" sky.fm
    playlist "$PLAYLISTJAZZ" "$JSONJAZZ" jazzradio.com
  8. hackruu created this gist Mar 23, 2015.
    70 changes: 70 additions & 0 deletions di-fm-premium-account-generator.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    #!/bin/bash
    #(c) 2015 hackru
    AGENT="AudioAddict-di/1.4.7 iOS/8.1"
    COOKIES="./cookies.txt"
    AUTH="ephemeron:dayeiph0ne@pp"
    DOMAIN=discard.email

    function rndsleep()
    {
    sleep .$[ ( $RANDOM % 4 ) + 1 ]s
    }

    # check for jshon
    which jshon >/dev/null || (echo "install jshon first"; exit 1) || exit 1
    # check for pwgen
    which jshon >/dev/null || (echo "install pwgen first"; exit 1) || exit 1

    # generate identity and password
    login=$(pwgen -0 $[ ( $RANDOM % 2 ) + 6 ] 1 | tr [A-Z] [a-z])
    lastname=$(pwgen -0 $[ ( $RANDOM % 4 ) + 8 ] 1 | tr [A-Z] [a-z])
    pass=$(pwgen -0 $[ ( $RANDOM % 2 ) + 6 ] 1 | tr [A-Z] [a-z])

    # register
    curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST 'https://api.audioaddict.com/v1/di/members' --user-agent "$AGENT" \
    --data-urlencode "member[first_name]=$login" --data-urlencode "member[last_name]=$lastname" \
    --data-urlencode "member[password_confirmation]=$pass" --data-urlencode "member[password]=$pass" --data-urlencode "member[email]=$login@$DOMAIN" >/dev/null

    rndsleep

    # login
    json=$(curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audioaddict.com/v1/di/members/authenticate" --user-agent "$AGENT" \
    --data-urlencode "username=$login@$DOMAIN" --data-urlencode "password=$pass")

    rndsleep

    # set envs
    api_key=$(echo "$json" | jshon -e api_key | tr -d '"')
    listen_key=$(echo "$json" | jshon -e listen_key | tr -d '"')
    id=$(echo "$json" | jshon -e id)

    rndsleep

    # check premium avail for this acct.
    curl -b $COOKIES -c $COOKIES -s -u $AUTH --request GET "https://api.audioaddict.com/v1/di/members/$id/subscriptions/trial_allowed/premium-pass?api_key=$api_key" \
    --user-agent "$AGENT" >/dev/null

    rndsleep

    # subscribe to 7 day premium trial
    curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audioaddict.com/v1/di/members/8948397/subscriptions/trial/premium-pass" \
    --user-agent "$AGENT" --data-urlencode "api_key=$api_key" >/dev/null

    rndsleep

    #login again
    json=$(curl -b $COOKIES -c $COOKIES -s -u $AUTH --request POST "https://api.audioaddict.com/v1/di/members/authenticate" --user-agent "$AGENT" \
    --data-urlencode "username=$login@$DOMAIN" --data-urlencode "password=$pass")

    # set envs
    api_key=$(echo "$json" | jshon -e api_key | tr -d '"')
    listen_key=$(echo "$json" | jshon -e listen_key | tr -d '"')
    id=$(echo "$json" | jshon -e id)
    activated=$(echo "$json" | jshon -e activated)

    echo "activated $activated"
    echo "listen_key $listen_key"
    echo "api_key $api_key"
    echo "id $id"
    echo "login $login@$DOMAIN"
    echo "password $pass"