Skip to content

Instantly share code, notes, and snippets.

@mipsparc
Last active April 17, 2016 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mipsparc/55be550d3cf49a4bc4b5f5caf4ea4acd to your computer and use it in GitHub Desktop.
Save mipsparc/55be550d3cf49a4bc4b5f5caf4ea4acd to your computer and use it in GitHub Desktop.
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