Skip to content

Instantly share code, notes, and snippets.

@mipsparc

mipsparc/nicomp3.sh

Last active Apr 17, 2016
Embed
What would you like to do?
require nicovideo-dl
#! /bin/sh
if [ $# -eq 3 ];then
VIDEOURI=$1
USER=$2
PASS=$3
else
VIDEOURI=$(zenity --entry --title "URI入力 - nicomp3" --text "URIを入力してください")
USER='hoge@example.com'
PASS='password'
fi
VIDEOID=${VIDEOURI##*/}
python nicovideo-dl $USER $PASS $VIDEOID
ffmpeg -loglevel panic -y -i $VIDEOID.* -acodec libmp3lame -ab 160k -ac 2 -ar 44100 $VIDEOID.mp3
VIDEONAME=$VIDEOID.*
VIDEOTITLE=`wget http://ext.nicovideo.jp/api/getthumbinfo/$VIDEOID -q -O - | xpath -e "/nicovideo_thumb_response/thumb/title/text()" 2>/dev/null`
mv $VIDEOID.mp3 "$VIDEOTITLE.mp3"
rm $VIDEONAME
echo 'Done: '$VIDEOTITLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.