Linux MySpace music downloader

For GUI version go here.
This is a Linux Bash script which downloads MySpace music. It requires a program called “rtmpdump”, that is available in Ubuntu repositories, in a deb package or as source. If ffmpeg program is installed, music is automatically converted to mp3, otherwise it is saved as .flv.
Note that your computer may have to be restarted after you install rtmpdump!

Download: myspace-dl-cli

Usage example:

  • ./getmusic.sh eminem
  • ./getmusic.sh ladygaga

#!/bin/bash --
# Myspace music downloader v7.0
# Author of Myspace music downloader <= 5.4: Luka Pusic <luka@pusic.si>
# Author of modifications for a working v6.0 version: Basile Bruneau <basilebruneau@gmail.com>
#
version='7.1'

echo "MySpace music downloader by http://360percents.com & http://ntag.fr"

#Updater - begining
lversionFile=`wget -L "https://raw.github.com/NTag/myspace-dl-cli/master/lastversion" --quiet --user-agent="Mozilla" -O -`
lversion=`echo "$lversionFile" | grep 'version' | sed -e 's/version://' | head -n 1`
lversionChangelog=`echo "$lversionFile" | grep 'changelog' | sed -e 's/changelog://' | head -n 1`
lversionUrl=`echo "$lversionFile" | grep 'url' | sed -e 's/url://' | head -n 1`
if [ "$version" != "$lversion" ]; then
 echo "[-] An update is available (v$lversion>v$version)"
 echo "[-] Fast changelog: $lversionChangelog"
 read -n1 -p "[-] Do you want to download it? (y/n) " wantupdate
 echo ""
 if [ "$wantupdate" = "y" ] || [ "$wantupdate" = "Y" ]; then
  echo "[.] Update"
  nameScript="${0##*/}"
  directory1=`dirname "$0"`
  directory2=`pwd`
  directory="$directory2/$directory1"
  echo "$directory"
  echo "[.] Download..."
  wget -L "$lversionUrl" --quiet -O "$directory/$nameScript"
  echo "[.] Launch of the new version!"
  echo ""
  "$directory/$nameScript" $1
  exit;
 else
  echo "[-] As you want!"
 fi
 echo ""
fi
#Updater - end

if [ -z "$1" ]; then
 echo "";echo "Usage: `basename $0` [USER (eg. eminem)]";echo "";exit
fi

type -P rtmpdump &>/dev/null || {
read -n1 -p "I need a program called rtmpdump, do you wan to install it now? (y/n) "
echo [[ $REPLY = [yY] ]] && sudo apt-get -qq -y install rtmpdump || { echo "You didn't answer yes, or installation failed. Install it manualy. Exiting...";}  >&2; exit 1; }

echo "[+] Requesting $1"
page=`wget -L "http://myspace.com/$1" --quiet --user-agent="Mozilla" -O -`

songs=`echo "$page" | grep '<button class="playBtn play_25 song" data-type="song"'`

songcount=$((`echo "$songs" | wc -l`))
if [ $((`echo "$songs" | wc -c`)) -lt "2" ]; then
 echo "[+] ERROR: no songs found at this url."
 echo "[-] Please submit bugs to: http://360percents.com/posts/linux-myspace-music-downloader/ and http://projets.ntag.fr/dlmyspace/";exit
fi
echo "[+] Found $songcount songs."

swf=`echo "$page" | grep '"playerSwf":"' | sed -e 's/.*"playerSwf":"//' -e 's/".*//' | head -n 1`

for i in `seq 1 $songcount`
do
 song=`echo "$songs" | sed -n "$i"p`
 artistname=`echo "$song" | sed -e 's/.*data-artist-name="//' -e 's/".*//' -e 's/\\//-/g' -e 's/[^A-Za-z0-9_]/_/g' -e 's/_\+/_/g' -e 's/^_//' -e 's/_$//' | head -n 1`
 albumname=`echo "$song" | sed -e 's/.*data-album-title="//' -e 's/".*//' -e 's/\\//-/g' -e 's/[^A-Za-z0-9_]/_/g' -e 's/_\+/_/g' -e 's/^_//' -e 's/_$//' | head -n 1`
 title=`echo "$song" | sed -e 's/.*data-title="//' -e 's/".*//' -e 's/\\//-/g' -e 's/[^A-Za-z0-9_]/_/g' -e 's/_\+/_/g' -e 's/^_//' -e 's/_$//' | head -n 1`
 rtmpb=`echo "$song" | sed -e 's/.*data-stream-url="//' -e 's/".*//' | head -n 1`
 file=`echo "$rtmpb" | sed 's/.*;//' | head -n 1`
 rtmp=`echo "$rtmpb" | sed 's/;.*//' | head -n 1`
 
 echo "[+]  Downloading $title..."
 rtmpdump -r "$rtmp" -a "" -f "LNX 11,2,202,235" -o "${albumname:-$artistname}-${title}.flv" -q -W "$swf" -p "http://www.myspace.com" -y "$file"
 
 if which ffmpeg >/dev/null; then
  echo "[+]  Converting $title to mp3..."
  (ffmpeg -y -i "${albumname:-$artistname}-${title}.flv" -metadata TITLE="$title" -metadata ARTIST="$artistname" -metadata ALBUM="$albumname" -acodec libmp3lame -ab 192000 -ar 44100 -f mp3 "${albumname:-$artistname}-${title}.mp3" > /dev/null 2>&1 && rm "${albumname:-$artistname}-${title}.flv") &
 fi
done

134 thoughts on “Linux MySpace music downloader

  1. I had to add -W “http://lads.myspacecdn.com/videos/MSMusicPlayer.swf” to the rtmpdump command line to get it to work.

  2. Hello. Thanks for sharing your script. It doesn’t seem to download any songs for me with debian sid.

    ./getmusic.sh http://www.myspace.com/eminem
    MySpace music downloader by http://360percents.com
    [+] Requesting http://www.myspace.com/eminem
    [+] Requesting XML playlist
    [+] Found 1 songs.
    Downloading ...

    did myspace change something?
    thanks.

      • Thanks!
        Works perfect with most bands. Can’t get it to work with this band though:

        ./getmusic.sh http://www.myspace.com/thetoughshits
        MySpace music downloader by http://360percents.com
        [+] Requesting http://www.myspace.com/thetoughshits
        [+] ERROR: userid or artistid is empty!
        [-] This is common when a change in MySpace occurs, or if this artists page is configured in a non usual way.
        [-] See http://360percents.com/posts/linux-myspace-music-downloader/ for info.

        Just in case you want to make it perfect and need some myspace links that don't work with the current script.
        Thanks again for sharing!

    • No, they didn’t change anything but your artist has a different setup.. I’m sorry… I’ll try to find a general solution for different setups later.

      You can still download it tho with this bash script i wrote just for this artist:

      #!/bin/bash --
      echo "This will download myspace.com/smokefairies songs!"

      link="http://www.myspace.com/music/services/player?playlistId=28526&action=getArtistPlaylist&artistId=9987268&artistUserId=43453633" xml=`wget --quiet -L $link --user-agent="Mozilla" -O -` songs=`echo "$xml" | tr ">" "\n" | grep 'songId' | tr ' ' "\n" | grep 'songId' | cut -d '"' -f 2` songcount=`echo "$songs" | wc -l` echo "[+] Found $songcount songs."

      for i in `seq 1 $songcount` do songid=`echo "$songs" | sed -n "$i"p` link="http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?action=getSong&ptype=4&sample=0&songId=$songid" songpage=`wget -L "$link" --quiet --user-agent="Mozilla" -O -` title=`echo "$songpage" | tr "<" "\n" | grep 'title' | tr ">" "\n" | grep -v 'title' | sed -e '/^$/d' | sort -u` rtmp=`echo "$songpage" | tr "<" "\n" | tr ">" "\n" | grep 'rtmp://' | uniq` echo "Downloading $title..." rtmpdump -r "$rtmp" -o "$title.flv" -q -W "http://lads.myspacecdn.com/videos/MSMusicPlayer.swf" done
  3. Example on how to modify the last code posted here by admin on Nov 28.
    Lets say we want the music from myspace.com/myreckless

    The needed variables can be found on this fragment of one of the lines on the sourcecode:
    plid=20482&profid=47034501&ptype=4&artid=3959576

    in the line of the last code posted that says:
    http://www.myspace.com/music/services/player?playlistId=28526&action=getArtistPlaylist&artistId=9987268&artistUserId=43453633

    Thanks so much Admin, this code works just great!
    change
    playlistId number for the number in plid
    artistUserId number for the number in profid
    artistId number for the number in artId

  4. Im trying to modify the plid, profid, and artid in the modfied code listed in the comments so i can download my own tracks from my music myspace page however im also getting the same output as “uu” was.

    i.e:

    “[+] Requesting http://www.myspace.com/bradaytes
    [-] User ID: Artist ID:
    [+] Requesting XML playlist
    [+] Found 1 songs.
    Downloading …”

    it just says found 1 songs and doesn’t download anything. any ideas on how to get this work properly?

    • This should work:

      #!/bin/bash
      echo "This will download myspace.com/bradaytes songs!"
      
      link="http://www.myspace.com/music/services/player?action=getArtistPlaylist&artistId=23214398&artistUserId=496437855&playlistId=107316"
      xml=`wget --quiet -L $link --user-agent="Mozilla" -O -`
      songs=`echo "$xml" | tr ">" "\n" | grep 'songId' | tr ' ' "\n" | grep 'songId' | cut -d '"' -f 2`
      songcount=`echo "$songs" | wc -l`
      echo "[+] Found $songcount songs."
      
      for i in `seq 1 $songcount`
      do
      songid=`echo "$songs" | sed -n "$i"p`
      link="http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?action=getSong&ptype=4&sample=0&songId=$songid"
      songpage=`wget -L "$link" --quiet --user-agent="Mozilla" -O -`
      title=`echo "$songpage" | tr "< " "\n" | grep 'title' | tr ">" "\n" | grep -v 'title' | sed -e '/^$/d' | sort -u`
      rtmp=`echo "$songpage" | tr "< " "\n" | tr ">" "\n" | grep 'rtmp://' | uniq`
      if [ ! "$title" ]; then
      title="$i"
      fi
      echo "Downloading $title..."
      rtmpdump -r "$rtmp" -o "$title.flv" -q -W "http://lads.myspacecdn.com/videos/MSMusicPlayer.swf"
      done
      

      PS: I also updated the original script so it downloads it too!

  5. I modified your script to extract the MP3 file out of the FLV container.
    After the rtmpdump command add the following line (requires ffmpeg to be installed)

    ffmpeg -i “$title.flv” -acodec copy “$title.mp3″ &>/dev/null && rm “$title.flv”

  6. Hi !
    I’m trying to download the song from http://www.myspace.com/stupeflip
    And the output is :
    MySpace music downloader by http://360percents.com
    [+] Requesting http://www.myspace.com/stupeflip
    [-] User ID:539871868 Artist ID:44182080
    [+] Requesting XML playlist
    [+] Found 2 songs.
    Downloading Stupeflip vite!!! Radio edit…
    Downloading LA MENUISERIE (extrait album)…

    The script found the song, but the file produce are only 0 byte.
    Can you help me for this ?

    Thanks :)

  7. Hey, works great, you should add ffmpeg as an obligatory piece of soft too.
    I added as Boo in commen #7 reommened.

    Today I noticed that this one is different: http://www.myspace.com/skreamuk

    MySpace music downloader by http://360percents.com
    [+] Requesting http://www.myspace.com/skreamuk
    [-] Trying second method for userID
    [-] User ID:125276228 Artist ID:1141839
    [+] Requesting XML playlist
    [+] Found 10 songs.
    Downloading 1…
    Downloading 2…
    Downloading 3…
    Downloading 4…
    Downloading 5…
    Downloading 6…
    Downloading 7…
    Downloading 8…
    Downloading 9…
    Downloading 10…

    Nothing is downloaded.

  8. It looks like this getmusic script might be the current solution for downloading music off of myspace. Hopefully it’s still working as of today (January 16, 2011). ???

    However, I can’t get it to work as it I’m currently running Ubuntu Studio 9.10, I tried adding the repository for rtmpdump and installing via source and even from synaptic package manager – it seems to be installed – though when I run the get music script it says it’s not installed and says to install it manually.

    Here’s what I did after rtmpdump apparently has been installed:

    ./getmusic.sh http://www.myspace.com/(band)

    MySpace music downloader by http://360percents.com
    I need a program called rtmpdump, do you wan to install it now? (y/n) y
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Couldn’t find package rtmpdump
    You didn’t answer yes, or installation failed. Install it manualy. Exiting…

    I did answer yes. I tried “yes” but immedaitely after “y” it ended up skipping ahead.

    To anyone reading this: please help. :-/ Thanks! :-)

    • Did you try to install it via .deb package directly?

      Download here for 64 bit version or here for 32 bit.

      Seems like a weird error. Open up your terminal and type in: rtmpdump, then post your output.

      • Ah okay it is working now. Solution required a reboot.

        I installed initially from source (not .deb). Though I don’t know which bit version it was, but I run a 64 bit CPU.

        The rtmpdump output is now what I am assuming as normal:

        “RTMPDump v2.1c
        (c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
        ERROR: You must specify a hostname (–host) or url (-r “rtmp://host[:port]/playpath”) containing a hostname

        Well, sans “error” but I just ran the getmusic script and it worked perfect. :-) Thank you. Very cool stuff.

  9. P.S. – I just found this:
    http://www.omgubuntu.co.uk/2010/06/easy-myspace-music-download-application/
    …although the application opens, I am unable to actually download music with it. It is able to recognize the myspace url and list all of the tracks, and even shows the files downloading when I click “download” (and when viewing the folder where they’re going they show up temporarily but disappear after they seem to finish downloading), and then the files are just… gone. :( I’m wondering if it’s actually an rtmpdump thing or if it’s something else. The “dlmsm” app seems to work, though the files vanish after they finish. Any ideas on dlmsm?

    • This program shows tracks here too, but fails to download them even with rtmpdump installed. Also, it downloads a bunch of other programs…

      But anyways, I think your rtmpdump is still not installed! Perhaps try restarting? Sound too Windows like, but you never know…

      • Now that getmusic.sh is working I don’t really have a need for that gui app (dlmsm). I did install that app via .deb, though, but it’s a kind of weird program for what it does offer with gui (seems more features would be available) but it’s not too bad. I’ll be sticking with the command line script though.

        Cheers

    • I’ve just tryed your artist and it works. Do you have rtmpdump correctly installed? If you just installed it restart your computer. How about ffmpeg?

  10. It works great!
    I’ve made my first (very hugly) GUI, called getmusic-gui.sh for getmusic.sh
    I’d like to share it whit you

    First install zenity (for Maverick should be default installed)
    I have getmusic.sh in the folder My_Script and i download from myspace in the folder Music.
    Remember to do
    sudo chmod 777 getmusic-gui.sh

    #!/bin/bash
    cd ~/Music
    mkdir new
    cd ~/Music/new
    artist=`zenity –entry –title=”Download from Myspace is forbidden ;)” –text “What do you listen today?” –width 400 $0`
    ~/My_Script/./getmusic.sh http://www.myspace.com/“$artist” | zenity –title=”Info” –text-info –width 400
    cd ~/Music
    mv new “$artist”
    end

    If you want also the progress bar, you can add at the end of getmusic.sh (ofter “done”) this lines:

    | zenity –progress –pulsate –auto-close

    Sorry for my ridiculous english…bye!

  11. Tested with rtmpdump and the flv download works great!

    But the ffmpeg command just renames the files and doesn’t convert them to mp3! I can’t play them on portable-mp3-players, audacious2, etc..

    To convert them use this command:
    ffmpeg -i “$title.flv” -f mp3 “$title.mp3″

    and it works perfectly!

  12. myspace Lieder mit Bash-Skript herunterladen « Rorschachs Tagebuch

  13. » MySpace Music Downloader Rerosku.it

  14. Hey, if you change “-f mp3″ to “-acodec copy” in the ffmpeg command, you can get an mp3 without having to re-encode the data.

  15. ./getmusic.sh: line 55: seq: command not found

    Bash 3 does not have seq. I am on OSX.

    I am trying to figure out how to do a string expansion with a variable.

    echo eval {1..$songcount}

    Expands correctly but I do not know how to place this into the for statement

  16. for i in `jot 1 “$songcount”`
    WORKS!

    the script will say that it found X songs

    [+] Found 8 songs.

    but it only downloads 1 song. the final song in the list.

    • Try using this implemented for loop instead of seq or jot:
      for (( i=1; i <= $songcount ; i++ ))

      Tell me if it works. Best regards

  17. Thanks for the great script. I slightly improved the script in order to write ID3 tags (artist and title) to the mp3 file. Furthermore, I set the bitrate to 128k (default is 64k). I attached the diff below.


    --- /tmp/getmusic.sh 2011-03-03 23:09:10.000000000 +0100
    +++ bin/getmusic.sh 2011-03-27 16:44:59.317521003 +0200
    @@ -17,6 +17,7 @@
    page=`wget -L "$1" --quiet --user-agent="Mozilla" -O -`
    userid=`echo "$page" | grep '?userId' | sed -e 's/.*userId=//' -e 's/".*//' | head -n 1`
    artistid=`echo "$page" | grep '&artid' | sed -e 's/.*artid=//' -e 's/&.*//' | head -n 1`
    +artistname=`echo "$page" | grep -o 'content=".* |' -m1 | sed -e 's/content="//' -e 's/ |.*//'`
    if [ ! "$userid" ]; then
    echo "[-] Trying second method for userID"
    userid=`echo "$page" | grep 'UserId' | sed -e 's/.*UserId=//' | sed -e 's/&.*//g' | head -n 1`
    @@ -28,6 +29,7 @@
    exit 1;
    fi
    echo "[-] User ID:$userid Artist ID:$artistid"
    +echo "[-] Arist Name: $artistname"
    echo "[+] Requesting XML playlist"
    link="http://www.myspace.com/music/services/player?artistUserId=$userid&action=getArtistPlaylist&artistId=$artistid"
    xml=`wget --quiet -L $link --user-agent="Mozilla" -O -`
    @@ -46,10 +48,10 @@
    #use number if no title found
    title="$i"
    fi
    -echo "Downloading $title..."
    +echo "$i/$songcount: Downloading $title..."
    rtmpdump -r "$rtmp" -o "$title.flv" -q -W "http://lads.myspacecdn.com/videos/MSMusicPlayer.swf"
    if which ffmpeg >/dev/null; then
    - echo "Converting $title to mp3..."
    - ffmpeg -y -i "$title.flv" -f mp3 "$title.mp3" > /dev/null 2>&1 && rm "$title.flv"
    + echo "$i/$songcount: Converting $title to mp3..."
    + ffmpeg -y -i "$title.flv" -metadata TITLE="$title" -metadata ARTIST="$artistname" -f mp3 -ab 128k "$artistname - $title.mp3" > /dev/null 2>&1 && rm "$title.flv"
    fi
    done

  18. As of 27th April 2011 the downloader is just downloading zero-length FLV files, while dlmsm is also creating, and then deleting, zero length FLV files.

      • The script is now working with the artist (Pigbag) that was not downloading previously, so it must have been a local or Myspace problem at my end. (dlmsm is still not functioning).

        Thanks.

          • Woooo… Thank you for the link. I experimented by substituting songId with the songId of Summer Reggae and voila, I got it.

            Thank you so much.

            Here’s the script by the way,

            #!/bin/bash –
            echo “This will download songs…”

            link=”http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?action=getSong&ptype=4&sample=0&songId=79979396″
            songpage=`wget -L “$link” –quiet –user-agent=”Mozilla” -O -`
            title=`echo “$songpage” | tr “” “\n” | grep -v ‘title’ | sed -e ‘/^$/d’ | sort -u`
            rtmp=`echo “$songpage” | tr “” “\n” | grep ‘rtmp://’ | uniq`

            echo “Downloading $title…”
            rtmpdump -r “$rtmp” -o “summer.flv” -q -W “http://lads.myspacecdn.com/videos/MSMusicPlayer.swf”
            ffmpeg -i summer.flv -acodec copy “summer.mp3″ &>/dev/null && rm “summer.flv”
            done

    • Here is their “playlist”: http://www.myspace.com/music/services/player?artistid=46630740&scssb=2&scsf=14&scsd=2&action=getSortedSongs

      So, the customized script for you is:

      #!/bin/bash --
      
      link="http://www.myspace.com/music/services/player?artistid=46630740&scssb=2&scsf=14&scsd=2&action=getSortedSongs"
      xml=`wget --quiet -L $link --user-agent="Mozilla" -O -`
      songs=`echo "$xml" | tr ">" "\n" | grep 'songId' | tr ' ' "\n" | grep 'songId' | cut -d '"' -f 2`
      songcount=`echo "$songs" | wc -l`
      echo "[+] Found $songcount songs."
      
      for i in `seq 1 $songcount`
      do
      songid=`echo "$songs" | sed -n "$i"p`
      link="http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?action=getSong&ptype=4&sample=0&songId=$songid"
      songpage=`wget -L "$link" --quiet --user-agent="Mozilla" -O -`
      title=`echo "$songpage" | tr "< " "\n" | grep 'title' | tr ">" "\n" | grep -v 'title' | sed -e '/^$/d' | sort -u`
      rtmp=`echo "$songpage" | tr "< " "\n" | tr ">" "\n" | grep 'rtmp://' | uniq`
      if [ ! "$title" ]; then
      #use number if no title found
      title="$i"
      fi
      echo "Downloading $title..."
      rtmpdump -r "$rtmp" -o "$title.flv" -q -W "http://lads.myspacecdn.com/videos/MSMusicPlayer.swf"
      if which ffmpeg >/dev/null; then
      	echo "Converting $title to mp3..."
      	ffmpeg -y -i "$title.flv" -metadata TITLE="$title" -metadata ARTIST="$artistname" -f mp3 -ab 128k "$artistname - $title.mp3" > /dev/null 2>&1 && rm "$title.flv"
      fi
      done
      

      Good luck

  19. Congratulations for the script, it’s awesome! I can download many songs. But I have an issue with an artist. It’s lovettmusic (http://myspace.com/lovettmusic). The script doesn’t download the 4 songs :(! I hope you will have the time to look this problem… Thanks!

    • Your artist uses another method for their playlist, but i fixed the script so it works now :) Download the new version and happy downloading! Best regards

  20. Amazing, thanks it works for lovettmusic :). However with this new version I have a new issue: when I download the artist nyxtone, only 1 song is found, but with the previous version 2 songs are found (the artist has 2 songs)…
    Best regards

  21. And, an other bug: the script want to add metadata to the mp3, but with my version of ffmpeg (version SVN-r13582 – on Debian) you can’t add metadata :(. And so, ffmpeg doesn’t recognize the command and abort the conversion. (“ffmpeg: unrecognized option ‘-metadata’”). I have deleted -metadata in the script so it works, but it would be better if the script detected the version of ffmpeg!

    • This is a sensitive issue, and I think version checking isn’t really the best solution… Lets try to think of something else…

  22. Hi, I tried your script and it didn’t work so I updated it for my specific case. Not sure whether it is a general solution but I post it anyways. Cheers.


    --- getmusic.sh 2011-06-05 13:10:30.000000000 +0200
    +++ bin/getmusic.sh 2011-06-21 18:08:49.306580775 +0200
    @@ -20,14 +20,20 @@
    echo "[-] Trying second method for userID"
    userid=`echo "$page" | grep 'UserId' | sed -e 's/.*UserId=//' | sed -e 's/&.*//g' | head -n 1`
    fi
    -if [ ! "$userid" -o ! "$artistid" ]; then
    - echo "[+] ERROR: userid or artistid is empty (user: $userid, arstist: $artistid)!";
    - echo '[-] This is common when a change in MySpace occurs, or if this artists page is configured in a non usual way.';
    - echo '[-] See http://360percents.com/posts/linux-myspace-music-downloader/ for info.';
    +if [ ! "$userid" -a ! "$artistid" ]; then
    + echo "[+] ERROR: userid and artistid are empty!";
    + echo "[-] This is common when a change in MySpace occurs, or if this artist's page is configured in a non usual way.";
    + echo "[-] See http://360percents.com/posts/linux-myspace-music-downloader/ for info.";
    exit 1;
    +elif [ ! "$userid" ]; then
    + echo "[+] WARNING: userid not found, using artistid instead";
    + userid="$artistid";
    +elif [ ! "$artistid" ]; then
    + echo "[+] WARNING: artistid not found, using userid instead";
    + artistid="$userid";
    fi
    echo "[-] User ID:$userid Artist ID:$artistid"
    -echo "[-] Arist Name: $artistname"
    +echo "[-] Artist Name: $artistname"
    echo "[+] Requesting XML playlist"
    link="http://www.myspace.com/music/services/player?artistid=$artistid&scssb=2&action=getSortedSongs"
    xml=`wget --quiet -L $link --user-agent="Mozilla" -O -`

  23. This script is wonderful, for most artists. I am having trouble with one, Lucas Santtana at http://www.myspace.com/santtana (note the double “t”).

    Can you explain how to locate the Artist ID and modify the customized script? I can not see “artid” or anything similar in the page source, so I am looking in the wrong place.

  24. i’m sorry for being such a beginner, the script worked and found the songs but the result was 0 byte :( someone had the same problem above and said the port has to be opened first..can someone explain to me how to do this? i’m using a mobile broadband connection.

  25. I changed the script.
    – fixed a typo (Arist -> Artist)
    – include Artist name in the generated filename – otherwise it’s a mess when you download multiple artists
    – remove the -ab 128k because it makes no sense and gets ignored. Since acodec is set to ‘copy’ (with the explicit goal of not re-encoding, which is the right way to do it) the bitrate is decided by the version inside the .flv file.

    here is the diff:

    @@ -27,7 +27,7 @@
    exit 1;
    fi
    echo “[-] User ID:$userid”
    -echo “[-] Arist Name: $artistname”
    +echo “[-] Artist Name: $artistname”
    echo “[+] Requesting XML playlist”
    link=”http://www.myspace.com/music/services/player?artistid=$userid&scssb=2&action=getSortedSongs”
    xml=`wget –quiet -L $link –user-agent=”Mozilla” -O -`
    @@ -56,9 +56,9 @@
    title=”$i” #use number if no title found
    fi
    echo “Downloading $title…”
    - rtmpdump -r “$rtmp” -o “$title.flv” -q -W “http://lads.myspacecdn.com/videos/MSMusicPlayer.swf”
    + rtmpdump -r “$rtmp” -o “$artistname – $title.flv” -q -W “http://lads.myspacecdn.com/videos/MSMusicPlayer.swf”
    if which ffmpeg >/dev/null; then
    echo “Converting $title to mp3…”
    - ffmpeg -y -i “$title.flv” -metadata TITLE=”$title” -metadata ARTIST=”$artistname” -acodec copy -f mp3 -ab 128k “$artistname – $title.mp3″ > /dev/null 2>&1 && rm “$title.flv”
    + ffmpeg -y -i “$artistname – $title.flv” -metadata TITLE=”$title” -metadata ARTIST=”$artistname” -acodec copy -f mp3 “$artistname – $title.mp3″ > /dev/null 2>&1 && rm “$artistname – $title.flv”
    fi
    done

  26. i hope it will help; for me, the flv files downloaded were empty, and ffmpeg could’nt convert them into mp3, so…

    - after installin’ ffmpeg ( “sudo apt-get install ffmpeg” ), be sure to download all the codecs by typing :

    wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2
    tar -xjvf all-20061022.tar.bz2
    sudo mkdir -p /usr/lib/codecs
    sudo cp all-20061022/* /usr/lib/codecs/

    - be sure to download the last “librtmp0″
    ( http://pkgs.org/package/librtmp0 )

    -be sure to download the last “rtmpdump”
    ( http://pkgs.org/package/rtmpdump )

    For me, now, it works like a charm :)

  27. Hi, in the version I just downloaded on line 62 you still have

    ffmpeg -y -i “$title.flv”

    But is should be

    ffmpeg -y -i “$artistname – $title.flv”

  28. There’s a little bug in v5.1 – ffmpeg is given a wrong input filename, and therefore converting to mp3 fails.

    Fixed version (with the broken version as comment):

    echo “Converting $title to mp3…”
    # ffmpeg -y -i “$title.flv” -metadata TITLE=”$title” -metadata ARTIST=”$artistname” -acodec copy -f mp3 “$artistname – $title.mp3″ > /dev/null 2>&1 && rm “$title.flv”
    ffmpeg -y -i “$artistname – $title.flv” -metadata TITLE=”$title” -metadata ARTIST=”$artistname” -acodec copy -f mp3 “$artistname – $title.mp3″ > /dev/null 2>&1 && rm “$artistname – $title.flv”
    fi

    After fixing that, the script works perfect :-)

  29. I’m trying to download a specific album by an artist. Is this possible with this script? Also, I can’t get transcoding to MP3 to work, I have ffmpeg installed, however, I’m on Fedora 15, I can get .flv files which are complete, but ffmpeg auto transcoding doesn’t work. I’m going to work on both my issues, see if I can resolve them, but any help would be appreciated.

  30. Hi,
    thanks for your script!

    At first, the transcoding from flv to mp3 failed without a notice. (I recommend removing “2>&1″ to not hide the error.) I found out that the problem was a long dash (–) instead of a minus (-) on line 62:

    ffmpeg -y -i "$artistname – $title.flv"

    Hence the input file was not found.

    After fixing this it works flawlessly! (v5.2)

  31. It only downloads 0 kb .flv.
    I’m on Ubuntu 10.04.3, I updated to the last rtmpdump (2.4) and still no content gets downloaded.
    I read all the comments, but I can’t seem to find a solution.
    The output:

    $ ./myspace-dl.sh queen
    MySpace music downloader by http://360percents.com
    [+] Requesting queen
    [-] User ID:393681726
    [-] Artist Name: Queen
    [+] Requesting XML playlist
    [-] Trying second method for playlist xml.
    [+] Found 5 songs.
    Downloading Keep Yourself Alive (Album Version)…
    Converting Keep Yourself Alive (Album Version) to mp3…
    Downloading Seven Seas Of Rhye…
    Converting Seven Seas Of Rhye to mp3…
    Downloading Killer Queen (Album Version)…
    Converting Killer Queen (Album Version) to mp3…
    Downloading Bohemian Rhapsody…
    Converting Bohemian Rhapsody to mp3…
    Downloading Somebody To Love…
    Converting Somebody To Love to mp3…

    …and the result is 5 correctly named empty (0 byte) FLV files.

    • I was hoping the fix which was submitted to github last week would work, but unfortunately it doesn’t. I’m currently without my main computer so the patch will take longer. It would be very helpful if somebody could help me fix it and make a pull request on github. It looks as if MySpace now requires more rtmpdump arguments… I’m really sorry to leave you guys waiting like this. Thank you for your patience!

  32. /hold$ ./myspace-dl.sh http://www.myspace.com/582113713/music/playlists/black-nasty-1441245
    MySpace music downloader by http://360percents.com
    [+] Requesting http://www.myspace.com/582113713/music/playlists/black-nasty-1441245
    [-] Trying second method for userID
    [-] User ID:0
    [-] Artist Name:
    [+] Requesting XML playlist
    [-] Trying second method for playlist xml.
    [+] ERROR: no songs found at this url.
    [-] Please submit bugs to: http://360percents.com/posts/linux-myspace-music-downloader/
    /hold$

    ive tried band name,a url to the bands page/player/radio and the play list made from the songs…

    nothing working..

  33. Télécharger les musiques de MySpace (2) ! | Blog de Basile Bruneau

  34. Télécharger les musiques de MySpace (2) ! | Blog de Basile Bruneau

    • NTag – thanks!! I tried it today and your modified script works on Debian 6 x86 :))

      And thanks Luka for coming up with a way to RIP the music, not record it!

  35. ./myspace-dl.sh http://www.myspace.com/seeniseemud
    MySpace music downloader by http://360percents.com & http://ntag.fr
    [+] Requesting http://www.myspace.com/seeniseemud
    [-] Trying second method for userID
    [+] ERROR: userid is empty!
    [-] This is common when a change in MySpace occurs, or if this artists page is configured in a non usual way.
    [-] See http://360percents.com/posts/linux-myspace-music-downloader/ or http://projets.ntag.fr/dlmyspace/ for more info.

  36. Neither of these scripts are working for me at the moment. When I try to download music from, eg. kirapurumusic, or squidsquadband, I end up with one flv file for each song, which is completely empty (0 bytes). Anyone know what might be wrong here?

      • Would it make more sense to post support requests on the github issue tracker? Seems like a more useful place for it – issue trackers are much more grokable than blog comment threads for this kind of stuff…

  37. SUPERB! This works! “C’est terrible!” as you French guys say. (No it does not mean “terrible”; but the contrary: “fantastic”, “great”)

    Thank you so much…

  38. btw this blog software sucks…you can never see whom you are replying to…this “SUPERB…” post was for the user NTag who improved the original script…

  39. Greetings,

    How to fetch $artistname by only $userid ?

    Another way for this ~#50 line:
    artistname=`echo “$page” | grep ‘og:title’ | sed -e ‘s/.*property=”og:title” content=”//’ -e ‘s/”.*//’ | head -n 1`

    ?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>