Skip to content

Instantly share code, notes, and snippets.

@yanyaoer
Created December 21, 2010 05:54
Show Gist options
  • Save yanyaoer/749555 to your computer and use it in GitHub Desktop.
Save yanyaoer/749555 to your computer and use it in GitHub Desktop.
获取xiami.com标为喜欢的艺人
#!/bin/bash
#虾米电台不给力啊! 哥要导到豆瓣去咯
#SETTING BEGAIN
uid='' #要抓的用户id, 比如我的就是11087
maxPage="25" #一共要抓的页数
i="0" #起始页数
TMP="/tmp/xiami" #缓存目录
FILE="./fav.txt" #最后保存文件
#SETTING END
while [ $i -lt $maxPage ]
do
i=$[$i+1]
curl -i http://www.xiami.com/space/lib-artist/u/$uid/page/$i | grep class=\"name >> $TMP
done
sed -e 's/^.*title="播放//g' -e 's/的电台.*$//g' -e 's/\+/\\+/g' -e 's/ /\+/g' $TMP > $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment