radikoの録音に失敗してた
不毛な議論が録音できてなかった.寝ちゃってたからMacの不具合かと思い,放っておいたら今日の99のANNも失敗してる.
radikoでラジオを録音→iTunesに登録→iPodに同期を自動実行 | 忘れたらググればいい
仕様変更があったみたい
twitterで検索してみたら情報が出てた
237 :まちがって名前消しちゃいました。:2012/10/24(水) 16:49:48.22 ID:??? player_2.0.1.00.swf ↓ player_3.0.0.01.swf swfextract -b 5 ↓ swfextract -b 14 radiko.smartstream.ne.jp ↓ w-radiko.smartstream.ne.jp simul-stream ↓ simul-stream.stream _defInst_ ↓ _definst_ これでイケた。
スクリプトを修正
これに従って修正.これで動いた.
get_auth.sh
3c3 < playerurl=http://radiko.jp/player/swf/player_2.0.1.00.swf --- > playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf 33c33 < /opt/local/bin/swfextract -b 5 /dev/stdin -o /dev/stdout | \ --- > /opt/local/bin/swfextract -b 14 /dev/stdin -o /dev/stdout | \
radiko.ksh
91c91 < rtmpe://radiko.smartstream.ne.jp/${ID}/_defInst_/simul-stream \ --- > rtmpe://w-radiko.smartstream.ne.jp/${ID}/_definst_/simul-stream.stream \
せっかくだからgistに置く.
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 | |
playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf | |
# | |
# access auth1_fms | |
# | |
auth1_fms=`/usr/local/bin/wget -q \ | |
--header="pragma: no-cache" \ | |
--header="X-Radiko-App: pc_1" \ | |
--header="X-Radiko-App-Version: 2.0.1" \ | |
--header="X-Radiko-User: test-stream" \ | |
--header="X-Radiko-Device: pc" \ | |
--post-data='\r\n' \ | |
--no-check-certificate \ | |
--save-headers \ | |
https://radiko.jp/v2/api/auth1_fms \ | |
-O -` | |
if [ $? -ne 0 -o ! "${auth1_fms}" ]; then | |
echo "failed auth1 process" 1>&2 | |
exit 1 | |
fi | |
# get keydata | |
# get partial key | |
# | |
authtoken=`echo ${auth1_fms} | perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)'` | |
offset=`echo ${auth1_fms} | perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)'` | |
length=`echo ${auth1_fms} | perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)'` | |
partialkey=`/usr/local/bin/wget -q -O - ${playerurl} 2>/dev/null | \ | |
/opt/local/bin/swfextract -b 14 /dev/stdin -o /dev/stdout | \ | |
dd bs=1 skip=${offset} count=${length} 2> /dev/null | \ | |
/opt/local/bin/base64` | |
if [ $? -ne 0 -o ! "${partialkey}" ]; then | |
echo "failed auth1 process" 1>&2 | |
exit 1 | |
fi | |
# | |
# access auth2_fms | |
# | |
auth2_fms=`/usr/local/bin/wget -q \ | |
--header="pragma: no-cache" \ | |
--header="X-Radiko-App: pc_1" \ | |
--header="X-Radiko-App-Version: 2.0.1" \ | |
--header="X-Radiko-User: test-stream" \ | |
--header="X-Radiko-Device: pc" \ | |
--header="X-Radiko-Authtoken: ${authtoken}" \ | |
--header="X-Radiko-Partialkey: ${partialkey}" \ | |
--post-data='\r\n' \ | |
--no-check-certificate \ | |
https://radiko.jp/v2/api/auth2_fms \ | |
-O -` | |
if [ $? -ne 0 -o ! "${auth2_fms}" ]; then | |
echo "failed auth2 process" 1>&2 | |
exit 1 | |
fi | |
### echo "authentication success" 1>&2 | |
areaid=`echo ${auth2_fms} | perl -ne 'print $1 if(/^([^,]+),/i)'` | |
### echo "areaid: ${areaid}" 1>&2 | |
echo "${playerurl}" "${authtoken}" |
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/ksh | |
#----------------------------------------------------------------- | |
# $1:ID (必須) | |
# TBS TBSラジオ | |
# QRR 文化放送 | |
# LFR ニッポン放送 | |
# NSB ラジオNIKKEI | |
# INT INTERFM | |
# FMT TOKYO FM | |
# BAYFM78 BayFm | |
# NACK5 NACK5 | |
# JORF ラジオ日本 | |
# YFM FM yokohama | |
# --------------------- | |
# ABC ABCラジオ | |
# MBS MBSラジオ | |
# OBC ラジオ大阪 | |
# CCL FM COCOLO | |
# 802 FM802 | |
# FMO FM大阪 | |
# | |
# $2:OFILE (必須) | |
# 任意のファイル名(UTF-8可) | |
# $3:TIME (必須) | |
# 録音時間(分) | |
# | |
# -t "VALUE" (省略可) | |
# タイトル | |
# -a "VALUE" (省略可) | |
# アーティスト | |
# -A "VALUE" (省略可) | |
# アルバム | |
# -g "VALUE" (省略可) | |
# ジャンル | |
#----------------------------------------------------------------- | |
export LANG="ja_JP.UTF-8" LC_ALL="ja_JP.UTF-8" | |
USAGE=\ | |
"Usage:$0 ID OFILE TIME [-t \"TITLE\"] [-a \"ARTIST\"] [-A \"ALBUM\"] [-g \"GENRE\"]" | |
if [ $# -lt 3 ];then | |
print "${USAGE}\n`head -n36 $0 | grep -v ksh | sed 's/^#//g' `" 1>&2 | |
exit 1 | |
fi | |
ID="$1" | |
OFILE="$2" | |
TIME=$3 | |
#------------------------------------------# | |
GetAuth_SRC="${HOME}/bin/get_auth.sh" | |
#------------------------------------------# | |
TOUT=1800 # sec | |
DELAY=20 # sec | |
RDIR=/tmp | |
CODEC=libmp3lame | |
####CODEC=libfaac | |
((TIME=TIME*60+DELAY)) | |
BITRATE=65536 | |
DATE1=$(date +%Y-%m-%d_%H.%M.%S) | |
DATE2=$(echo ${DATE1} | cut -c1-10) | |
YEAR=$(echo ${DATE1} | cut -c1-4) | |
shift 3 | |
while getopts a:g:t:A: opt | |
do | |
case ${opt} in | |
t) TITLE="${OPTARG}";; | |
a) AUTHOR="${OPTARG}";; | |
g) GENRE="${OPTARG}";; | |
A) ALBUM="${OPTARG}";; | |
*) echo ${USAGE} 1>&2 | |
exit 1;; | |
esac | |
done | |
if [ "${CODEC}" = "libmp3lame" ];then | |
RFILE="${RDIR}/${ID}_${OFILE}_${DATE1}.mp3" | |
else | |
RFILE="${RDIR}/${ID}_${OFILE}_${DATE1}.m4a" | |
fi | |
### authentication | |
RAuth=`${GetAuth_SRC}` | |
set -- ${RAuth} | |
playerurl=$1 | |
authtoken=$2 | |
/usr/local/bin/rtmpdump -B ${TIME} -m ${TOUT} -qvr \ | |
rtmpe://w-radiko.smartstream.ne.jp/${ID}/_definst_/simul-stream.stream \ | |
-W ${playerurl} -C S:"" -C S:"" -C S:"" -C S:${authtoken} \ | |
-o - 2>/dev/null | \ | |
/opt/local/bin/ffmpeg \ | |
-metadata author="${AUTHOR}" \ | |
-metadata artist="${AUTHOR}" \ | |
-metadata title="${TITLE}" \ | |
-metadata album="${ALBUM}" \ | |
-metadata genre="${GENRE}" \ | |
-metadata year="${YEAR}" \ | |
-y -i - -vn -acodec ${CODEC} -ar 44100 -ab ${BITRATE} -ac 2 "${RFILE}" > /dev/null 2>&1 | |
iTunes_DIR=`find "${HOME}" -name "iTunes に自動的に追加" -type d | grep -vi trash` | |
if [ "${iTunes_DIR}" ]; then | |
cp "${RFILE}" "${iTunes_DIR}" | |
if [ "$?" = "0" ]; then | |
rm -f "${RFILE}" | |
fi | |
fi |
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 | |
ID="LFR" | |
OFILE="99ann" | |
TIME="125" | |
date=`date -v-1d +%Y年%m月%d日` | |
TITLE="${date} ナインティナインのオールナイトニッポン" | |
ARTIST="ニッポン放送" | |
ALBUM="ナインティナインのオールナイトニッポン" | |
GENRE="ラジオ" | |
~/bin/radiko.ksh ${ID} ${OFILE} ${TIME} -t "${TITLE}" -a "${ARTIST}" -A "${ALBUM}" -g "${GENRE}" | |
open ~/bin/sync_ipod.app/ |