Last active
April 17, 2016 00:14
-
-
Save mipsparc/55be550d3cf49a4bc4b5f5caf4ea4acd to your computer and use it in GitHub Desktop.
require nicovideo-dl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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