ubuntuusers.de

myspace.sh

Autor:
Funatiker
Datum:
31. Oktober 2010 17:56
Code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# myspace.sh - 0.0.1 pre-alpha1
# Copyright (C) 2010 Funatiker
# under the terms of the GNU General Public License

# usage: myspace.sh NAME
# description: downloads the songs from myspace.com/NAME
# dependencies: curl, rtmpdump

#artistId und friendId auslesen
ids=$(curl -s "http://www.myspace.com/$1" | grep profid.*artid | head -n1 | sed 's/&/\n/g' | grep -E "profid|artid" | cut -d\= -f2)
friendId=$(echo $ids | cut -d\  -f1)
artistId=$(echo $ids | cut -d\  -f2)

#Playlists bekommen
for playlistId in $(curl -s "http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?friendId=$friendId&action=getPlaylists" | sed 's/ /\n/g' | grep playlistId | cut -d\" -f2)
do
        #IDs der Songs bekommen
        for songId in $(curl -s "http://www.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?artistId=$artistId&action=getArtistPlaylist&artistUserId=$friendId&playlistId=$playlistId&ptype=4" | sed 's/ /\n/g' | grep songId | cut -d\" -f2)
        do
                #rtmp-Link bekommen
                rtmp=$(curl -s "http://www.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?songId=$songId&action=getSong&ptype=4" | sed -e 's/rtmp>/\n/g' -e 's/<\///g' -e 's/rtmp/rtmpe/g' | grep rtmp)
                #dateinamen festlegen
                file=$1"_"$(echo $rtmp | sed 's/\//\n/g' | tail -n1)
                # DUMPEN!
                rtmpdump -r $rtmp -o $file  --swfVfy http://lads.myspacecdn.com/videos/MSMusicPlayer.swf
        done
done