Revisions
-
macrat revised this gist
Aug 28, 2016 . 5 changed files with 6 additions and 374 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,40 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,5 @@ #!/bin/bash if [ $# -eq 1 ]; then channel=$1 else @@ -25,8 +23,8 @@ fi # pid=$$ date=`date '+%Y-%m-%d-%H:%M'` playerurl=http://radiko.jp/player/swf/player_4.1.0.00.swf outdir="${XDG_CACHE_HOME:-/tmp}/radio" playerfile="${outdir}/player.swf" keyfile="${outdir}/authkey.png" auth1_fms_file="${outdir}/auth1_fms_${pid}" @@ -91,7 +89,7 @@ length=`perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)' ${auth1_fms_file}` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` printf "authtoken: ${authtoken}\noffset: ${offset} length: ${length}\npartialkey: $partialkey\n" rm -f ${auth1_fms_file} @@ -127,28 +125,13 @@ echo "areaid: $areaid" rm -f ${auth2_fms_file} # # rtmpdump and mplayer # rtmpdump -v \ -r 'rtmpe://f-radiko.smartstream.ne.jp' \ --app "${channel}/_definst_" \ --playpath 'simul-stream.stream' \ -W $playerurl \ -C S:"" -C S:"" -C S:"" -C S:$authtoken \ --live\ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,59 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,70 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,182 +0,0 @@ -
ihsoy-s revised this gist
May 5, 2014 . 2 changed files with 28 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -24,19 +24,17 @@ fi # # parameter setting # playerurl="http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf" rtmpurl="rtmpe://netradio-${channel}-flash.nhk.jp/live/${playpath}" buffer=1000 # # rtmpdump and mplayer # rtmpdump \ --rtmp "${rtmpurl}" \ --swfVfy ${playerurl} \ --live \ --buffer ${buffer} \ --flv - \ | mplayer - This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,23 +6,17 @@ if [ $# -eq 2 ]; then channel=$1 duration=`expr $2 \* 60` outputprefix="NHK-${channel}" outdir="${XDG_CACHE_HOME}/radio/" elif [ $# -eq 3 ]; then channel=$1 duration=`expr $2 \* 60` outputprefix=$3 outdir="${XDG_CACHE_HOME}/radio/" elif [ $# -eq 4 ]; then channel=$1 duration=`expr $2 \* 60` outputprefix=$3 outdir=$4 else @@ -37,36 +31,40 @@ fi # # parameter setting # case ${channel} in r1) playpath='NetRadio_R1_flash@63346' ;; r2) playpath='NetRadio_R2_flash@63342' ;; fm) playpath='NetRadio_FM_flash@63343' ;; *) exit 1 ;; esac date=`date '+%Y-%m-%d-%H%M'` playerurl="http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf" rtmpurl="rtmpe://netradio-${channel}-flash.nhk.jp/live/${playpath}" buffer=1000 mkdir -p ${outdir} # # rtmpdump # rtmpdump --quiet \ --rtmp "${rtmpurl}" \ --swfVfy ${playerurl} \ --live \ --buffer ${buffer} \ --stop ${duration} \ --flv - > "${outdir}/NHK-${channel}_${date}" # mp3 encode #ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${outputprefix}_${date}.mp3" # ogg encode #ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec libvorbis -aq 3 "${outdir}/${outputprefix}_${date}.ogg" # dump stream (AAC) #ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.aac" avconv -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.m4a" if [ $? = 0 ]; then rm -f "${outdir}/NHK-${channel}_${date}" fi -
ihsoy-s revised this gist
Apr 27, 2014 . 3 changed files with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ fi # # parse asx file # mmsurl=`nkf -w ${asxfile} | gawk '/href=/ {print $0}' | sed -e 's/.*\(mms\:\/\/[^">]\+\).*/\1/'` # 出力ファイル名はasxファイルのファイル名に合わせる outputfile="${asxfile%.*}.${mmsurl##*.}" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,7 @@ fi # parameter setting # pid=$$ date=`date '+%Y-%m-%d-%H%M'` playerurl="http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf" rtmpurl="rtmpe://netradio-${channel}-flash.nhk.jp" targetapp="live" @@ -61,10 +61,11 @@ rtmpdump -v -q \ #ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${outputprefix}_${date}.mp3" # ogg encode #ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec libvorbis -aq 3 "${outdir}/${outputprefix}_${date}.ogg" # 再エンコしない (AAC) 場合 #ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.aac" avconv -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.m4a" if [ $? = 0 ]; then rm -f "${outdir}/${channel}_${date}" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ fi # parameter setting # pid=$$ date=`date '+%Y-%m-%d-%H%M'` playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf playerfile="${outdir}/player.swf" keyfile="${outdir}/authkey.png" @@ -174,7 +174,8 @@ rtmpdump -v -q \ #ffmpeg -loglevel quiet -y -i "${outdir}/${channel}_${date}" -acodec libvorbis -aq 3 "${outdir}/${outputprefix}_${date}.ogg" # 再エンコしない (AAC) 場合 #ffmpeg -loglevel quiet -y -i "${outdir}/${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.aac" avconv -loglevel quiet -y -i "${outdir}/${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.m4a" if [ $? = 0 ]; then rm -f "${outdir}/${channel}_${date}" -
ihsoy-s revised this gist
Apr 2, 2013 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -48,7 +48,7 @@ mkdir -p ${outdir} # # rtmpdump # rtmpdump -v -q \ -r "${rtmpurl}" \ --app "${targetapp}" \ --playpath "${playpath}" \ @@ -58,13 +58,13 @@ rtmpdump -v \ --flv "${outdir}/NHK-${channel}_${date}" # mp3 encode #ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${outputprefix}_${date}.mp3" # ogg encode ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec libvorbis -aq 3 "${outdir}/${outputprefix}_${date}.ogg" # 再エンコしない (AAC) 場合 # ffmpeg -loglevel quiet -y -i "${outdir}/NHK-${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.aac" if [ $? = 0 ]; then rm -f "${outdir}/${channel}_${date}" -
ihsoy-s revised this gist
Apr 2, 2013 . 5 changed files with 327 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ #!/bin/bash # 下記を参考にしつつ作成 # https://gist.github.com/matchy2/3956266 # https://gist.github.com/saiten/1185755 if [ $# -eq 1 ]; then channel=$1 case $1 in r1) playpath='NetRadio_R1_flash@63346' ;; r2) playpath='NetRadio_R2_flash@63342' ;; fm) playpath='NetRadio_FM_flash@63343' ;; *) exit 1 ;; esac else echo "usage : $0 channel_name" echo " channel_name list" echo " NHK Radio #1: r1" echo " NHK Radio #2: r2" echo " NHK-FM: fm" exit 1 fi # # parameter setting # pid=$$ date=`date '+%Y-%m-%d-%H:%M'` playerurl="http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf" rtmpurl="rtmpe://netradio-${channel}-flash.nhk.jp" targetapp="live" # # rtmpdump and mplayer # rtmpdump -v \ -r "${rtmpurl}" \ --app "${targetapp}" \ --playpath "${playpath}" \ -W $playerurl \ --live\ | mplayer - This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,155 @@ #!/bin/bash # https://gist.github.com/matchy2/3956266 を若干修正 if [ $# -eq 1 ]; then channel=$1 else echo "usage : $0 channel_name" echo " channel_name list" echo " TBS Radio: TBS" echo " Nippon Cultural Broadcasting: QRR" echo " Nippon Broadcasting: LFR" echo " Radio Nippon: JORF" echo " Inter FM: INT" echo " Tokyo FM: FMT" echo " J-WAVE: FMJ" echo " bayfm 78.0MHz: BAYFM78" echo " NACK5: NACK5" echo " FM yokohama 84.7: YFM" exit 1 fi # # parameter setting # pid=$$ date=`date '+%Y-%m-%d-%H:%M'` playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf outdir="${XDG_CACHE_HOME}/radio/" playerfile="${outdir}/player.swf" keyfile="${outdir}/authkey.png" auth1_fms_file="${outdir}/auth1_fms_${pid}" auth2_fms_file="${outdir}/auth2_fms_${pid}" channel_file="${outdir}/${channel}.xml" mkdir -p ${outdir} # # get player # if [ ! -f $playerfile ]; then wget -q -O $playerfile $playerurl if [ $? -ne 0 ]; then echo "failed to get player" exit 1 fi fi # # get keydata (need swftool) # if [ ! -f $keyfile ]; then swfextract -b 14 $playerfile -o $keyfile if [ ! -f $keyfile ]; then echo "failed to get keydata" exit 1 fi fi if [ -f ${auth1_fms_file} ]; then rm -f ${auth1_fms_file} fi # # access auth1_fms # 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 \ -O ${auth1_fms_file} \ https://radiko.jp/v2/api/auth1_fms if [ $? -ne 0 ]; then echo "failed auth1 process" exit 1 fi # # get partial key # authtoken=`perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)' ${auth1_fms_file}` offset=`perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)' ${auth1_fms_file}` length=`perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)' ${auth1_fms_file}` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` echo "authtoken: ${authtoken} \noffset: ${offset} length: ${length} \npartialkey: $partialkey" rm -f ${auth1_fms_file} if [ -f ${auth2_fms_file} ]; then rm -f ${auth2_fms_file} fi # # access auth2_fms # 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 \ -O ${auth2_fms_file} \ https://radiko.jp/v2/api/auth2_fms if [ $? -ne 0 -o ! -f ${auth2_fms_file} ]; then echo "failed auth2 process" exit 1 fi echo "authentication success" areaid=`perl -ne 'print $1 if(/^([^,]+),/i)' ${auth2_fms_file}` echo "areaid: $areaid" rm -f ${auth2_fms_file} # # get stream-url # if [ -f ${channel_file} ]; then rm -f ${channel_file} fi wget -q "http://radiko.jp/v2/station/stream/${channel}.xml" -O ${channel_file} stream_url=`echo "cat /url/item[1]/text()" | xmllint --shell ${channel_file} | tail -2 | head -1` url_parts=(`echo ${stream_url} | perl -pe 's!^(.*)://(.*?)/(.*)/(.*?)$/!$1://$2 $3 $4!'`) rm -f ${channel_file} # # rtmpdump and mplayer # rtmpdump -v \ -r ${url_parts[0]} \ --app ${url_parts[1]} \ --playpath ${url_parts[2]} \ -W $playerurl \ -C S:"" -C S:"" -C S:"" -C S:$authtoken \ --live\ | mplayer - This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ #!/bin/bash # # mmsなストリーミングのasxファイルを読み込み、ストリームをdumpする # 1. asxファイルをダウンロード # 2. asxファイルのなかからURL(mms://~)を取得 # 3. mplayerでdump # if [ $# -eq 1 ]; then url=$1 outdir="${XDG_CACHE_HOME}/radio/" elif [ $# -eq 2 ]; then url=$1 outdir=$2 else echo "usage : $0 url [outputdir]" exit 1 fi # # parameter setting # pid=$$ tmpdir="${XDG_CACHE_HOME}/radio/" asxfile="${tmpdir}/${url##*/}" mkdir -p ${tmpdir} mkdir -p ${outdir} # # get asx file # if [ ! -f ${asxfile} ]; then wget -q -O ${asxfile} ${url} if [ $? -ne 0 ]; then echo "failed to get ${url}" exit 1 fi fi # # parse asx file # mmsurl=`gawk '/href=/ {print $0}' ${asxfile} | sed -e 's/.*\(mms\:\/\/[^">]\+\).*/\1/'` # 出力ファイル名はasxファイルのファイル名に合わせる outputfile="${asxfile%.*}.${mmsurl##*.}" # # dump # mplayer ${mmsurl} -dumpstream -dumpfile ${outputfile} if [ $? = 0 ]; then rm -f ${asxfile} fi This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ #!/bin/bash # 下記を参考にしつつ作成 # https://gist.github.com/matchy2/3956266 # https://gist.github.com/saiten/1185755 if [ $# -eq 2 ]; then channel=$1 DURATION=`expr $2 \* 60` case $1 in r1) playpath='NetRadio_R1_flash@63346' ;; r2) playpath='NetRadio_R2_flash@63342' ;; fm) playpath='NetRadio_FM_flash@63343' ;; *) exit 1 ;; esac outputprefix="NHK-${channel}" outdir="${XDG_CACHE_HOME}/radio/" elif [ $# -eq 3 ]; then channel=$1 DURATION=`expr $2 \* 60` outputprefix=$3 outdir="${XDG_CACHE_HOME}/radio/" elif [ $# -eq 4 ]; then channel=$1 DURATION=`expr $2 \* 60` outputprefix=$3 outdir=$4 else echo "usage : $0 channel_name duration(minuites) [filename_prefix [output_dir]]" echo " channel_name list" echo " NHK Radio #1: r1" echo " NHK Radio #2: r2" echo " NHK-FM: fm" exit 1 fi # # parameter setting # pid=$$ date=`date '+%Y-%m-%d-%H:%M'` playerurl="http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf" rtmpurl="rtmpe://netradio-${channel}-flash.nhk.jp" targetapp="live" mkdir -p ${outdir} # # rtmpdump # rtmpdump -v \ -r "${rtmpurl}" \ --app "${targetapp}" \ --playpath "${playpath}" \ -W $playerurl \ --live\ --stop ${DURATION} \ --flv "${outdir}/NHK-${channel}_${date}" # mp3 encode #ffmpeg -y -i "${outdir}/NHK-${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${outputprefix}_${date}.mp3" # ogg encode ffmpeg -y -i "${outdir}/NHK-${channel}_${date}" -acodec libvorbis -aq 3 "${outdir}/${outputprefix}_${date}.ogg" # 再エンコしない (AAC) 場合 # ffmpeg -y -i "${outdir}/NHK-${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.aac" if [ $? = 0 ]; then rm -f "${outdir}/${channel}_${date}" fi Empty file. -
ihsoy-s revised this gist
Apr 2, 2013 . 1 changed file with 66 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,51 @@ #!/bin/bash # https://gist.github.com/matchy2/3956266 を若干修正 if [ $# -eq 2 ]; then channel=$1 DURATION=`expr $2 \* 60` outdir="${XDG_CACHE_HOME}/radio/" outputprefix=${channel} elif [ $# -eq 3 ]; then channel=$1 DURATION=`expr $2 \* 60` outputprefix=$3 outdir="${XDG_CACHE_HOME}/radio/" elif [ $# -eq 4 ]; then channel=$1 DURATION=`expr $2 \* 60` outputprefix=$3 outdir=$4 else echo "usage : $0 channel_name duration(minutes) [filename_prefix [output_dir]]" echo " channel_name list" echo " TBS Radio: TBS" echo " Nippon Cultural Broadcasting: QRR" echo " Nippon Broadcasting: LFR" echo " Radio Nippon: JORF" echo " Inter FM: INT" echo " Tokyo FM: FMT" echo " J-WAVE: FMJ" echo " bayfm 78.0MHz: BAYFM78" echo " NACK5: NACK5" echo " FM yokohama 84.7: YFM" exit 1 fi # # parameter setting # pid=$$ date=`date '+%Y-%m-%d-%H:%M'` playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf playerfile="${outdir}/player.swf" keyfile="${outdir}/authkey.png" auth1_fms_file="${outdir}/auth1_fms_${pid}" auth2_fms_file="${outdir}/auth2_fms_${pid}" channel_file="${outdir}/${channel}.xml" mkdir -p ${outdir} # # get player # @@ -43,8 +70,8 @@ if [ ! -f $keyfile ]; then fi fi if [ -f ${auth1_fms_file} ]; then rm -f ${auth1_fms_file} fi # @@ -59,7 +86,7 @@ wget -q \ --post-data='\r\n' \ --no-check-certificate \ --save-headers \ -O ${auth1_fms_file} \ https://radiko.jp/v2/api/auth1_fms if [ $? -ne 0 ]; then @@ -70,18 +97,18 @@ fi # # get partial key # authtoken=`perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)' ${auth1_fms_file}` offset=`perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)' ${auth1_fms_file}` length=`perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)' ${auth1_fms_file}` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` echo "authtoken: ${authtoken} \noffset: ${offset} length: ${length} \npartialkey: $partialkey" rm -f ${auth1_fms_file} if [ -f ${auth2_fms_file} ]; then rm -f ${auth2_fms_file} fi # @@ -97,52 +124,58 @@ wget -q \ --header="X-Radiko-Partialkey: ${partialkey}" \ --post-data='\r\n' \ --no-check-certificate \ -O ${auth2_fms_file} \ https://radiko.jp/v2/api/auth2_fms if [ $? -ne 0 -o ! -f ${auth2_fms_file} ]; then echo "failed auth2 process" exit 1 fi echo "authentication success" areaid=`perl -ne 'print $1 if(/^([^,]+),/i)' ${auth2_fms_file}` echo "areaid: $areaid" rm -f ${auth2_fms_file} # # get stream-url # if [ -f ${channel_file} ]; then rm -f ${channel_file} fi wget -q "http://radiko.jp/v2/station/stream/${channel}.xml" -O ${channel_file} stream_url=`echo "cat /url/item[1]/text()" | xmllint --shell ${channel_file} | tail -2 | head -1` url_parts=(`echo ${stream_url} | perl -pe 's!^(.*)://(.*?)/(.*)/(.*?)$/!$1://$2 $3 $4!'`) rm -f ${channel_file} # # rtmpdump # rtmpdump -v -q \ -r ${url_parts[0]} \ --app ${url_parts[1]} \ --playpath ${url_parts[2]} \ -W $playerurl \ -C S:"" -C S:"" -C S:"" -C S:$authtoken \ --live \ --stop ${DURATION} \ --flv "${outdir}//${channel}_${date}" # mp3 encode #ffmpeg -loglevel quiet -y -i "${outdir}/${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${outputprefix}_${date}.mp3" # ogg encode #ffmpeg -loglevel quiet -y -i "${outdir}/${channel}_${date}" -acodec libvorbis -aq 3 "${outdir}/${outputprefix}_${date}.ogg" # 再エンコしない (AAC) 場合 ffmpeg -loglevel quiet -y -i "${outdir}/${channel}_${date}" -acodec copy "${outdir}/${outputprefix}_${date}.aac" if [ $? = 0 ]; then rm -f "${outdir}/${channel}_${date}" fi -
matchy256 revised this gist
Feb 13, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -141,6 +141,8 @@ rtmpdump -v \ --flv "/tmp/${channel}_${date}" ffmpeg -y -i "/tmp/${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${channel}_${date}.mp3" # 再エンコしない (AAC) 場合 # ffmpeg -y -i "/tmp/${channel}_${date}" -acodec copy "${outdir}/${channel}_${date}.aac" if [ $? = 0 ]; then rm -f "/tmp/${channel}_${date}" fi -
matchy256 revised this gist
Nov 19, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -141,4 +141,6 @@ rtmpdump -v \ --flv "/tmp/${channel}_${date}" ffmpeg -y -i "/tmp/${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${channel}_${date}.mp3" if [ $? = 0 ]; then rm -f "/tmp/${channel}_${date}" fi -
matchy256 revised this gist
Oct 26, 2012 . 1 changed file with 14 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ #!/bin/sh pid=$$ date=`date '+%Y-%m-%d-%H:%M'` playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf playerfile="/tmp/player.swf" @@ -42,8 +43,8 @@ if [ ! -f $keyfile ]; then fi fi if [ -f auth1_fms_${pid} ]; then rm -f auth1_fms_${pid} fi # @@ -58,7 +59,7 @@ wget -q \ --post-data='\r\n' \ --no-check-certificate \ --save-headers \ -O auth1_fms_${pid} \ https://radiko.jp/v2/api/auth1_fms if [ $? -ne 0 ]; then @@ -69,18 +70,18 @@ fi # # get partial key # authtoken=`perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)' auth1_fms_${pid}` offset=`perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)' auth1_fms_${pid}` length=`perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)' auth1_fms_${pid}` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` echo "authtoken: ${authtoken} \noffset: ${offset} length: ${length} \npartialkey: $partialkey" rm -f auth1_fms_${pid} if [ -f auth2_fms_${pid} ]; then rm -f auth2_fms_${pid} fi # @@ -96,20 +97,20 @@ wget -q \ --header="X-Radiko-Partialkey: ${partialkey}" \ --post-data='\r\n' \ --no-check-certificate \ -O auth2_fms_${pid} \ https://radiko.jp/v2/api/auth2_fms if [ $? -ne 0 -o ! -f auth2_fms_${pid} ]; then echo "failed auth2 process" exit 1 fi echo "authentication success" areaid=`perl -ne 'print $1 if(/^([^,]+),/i)' auth2_fms_${pid}` echo "areaid: $areaid" rm -f auth2_fms_${pid} # # get stream-url -
matchy256 revised this gist
Oct 26, 2012 . 1 changed file with 14 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -42,8 +42,8 @@ if [ ! -f $keyfile ]; then fi fi if [ -f auth1_fms_${channel} ]; then rm -f auth1_fms_${channel} fi # @@ -58,7 +58,7 @@ wget -q \ --post-data='\r\n' \ --no-check-certificate \ --save-headers \ -O auth1_fms_${channel} \ https://radiko.jp/v2/api/auth1_fms if [ $? -ne 0 ]; then @@ -69,18 +69,18 @@ fi # # get partial key # authtoken=`perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)' auth1_fms_${channel}` offset=`perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)' auth1_fms_${channel}` length=`perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)' auth1_fms_${channel}` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` echo "authtoken: ${authtoken} \noffset: ${offset} length: ${length} \npartialkey: $partialkey" rm -f auth1_fms_${channel} if [ -f auth2_fms_${channel} ]; then rm -f auth2_fms_${channel} fi # @@ -96,20 +96,20 @@ wget -q \ --header="X-Radiko-Partialkey: ${partialkey}" \ --post-data='\r\n' \ --no-check-certificate \ -O auth2_fms_${channel} \ https://radiko.jp/v2/api/auth2_fms if [ $? -ne 0 -o ! -f auth2_fms_${channel} ]; then echo "failed auth2 process" exit 1 fi echo "authentication success" areaid=`perl -ne 'print $1 if(/^([^,]+),/i)' auth2_fms_${channel}` echo "areaid: $areaid" rm -f auth2_fms_${channel} # # get stream-url @@ -136,7 +136,7 @@ rtmpdump -v \ -W $playerurl \ -C S:"" -C S:"" -C S:"" -C S:$authtoken \ --live \ --stop ${DURATION} \ --flv "/tmp/${channel}_${date}" ffmpeg -y -i "/tmp/${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${channel}_${date}.mp3" -
matchy256 revised this gist
Oct 26, 2012 . 1 changed file with 28 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,20 @@ #!/bin/sh date=`date '+%Y-%m-%d-%H:%M'` playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf playerfile="/tmp/player.swf" keyfile="/tmp/authkey.png" if [ $# -eq 2 ]; then channel=$1 DURATION=`expr $2 \* 60` outdir="." elif [ $# -eq 3 ]; then channel=$1 DURATION=`expr $2 \* 60` outdir=$3 else echo "usage : $0 channel_name duration(minuites) [outputdir]" exit 1 fi @@ -39,8 +42,8 @@ if [ ! -f $keyfile ]; then fi fi if [ -f auth1_fms_$channel ]; then rm -f auth1_fms_$channel fi # @@ -55,6 +58,7 @@ wget -q \ --post-data='\r\n' \ --no-check-certificate \ --save-headers \ -O auth1_fms_$channel \ https://radiko.jp/v2/api/auth1_fms if [ $? -ne 0 ]; then @@ -65,18 +69,18 @@ fi # # get partial key # authtoken=`perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)' auth1_fms_$channel` offset=`perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)' auth1_fms_$channel` length=`perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)' auth1_fms_$channel` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` echo "authtoken: ${authtoken} \noffset: ${offset} length: ${length} \npartialkey: $partialkey" rm -f auth1_fms_$channel if [ -f auth2_fms_$channel ]; then rm -f auth2_fms_$channel fi # @@ -92,19 +96,20 @@ wget -q \ --header="X-Radiko-Partialkey: ${partialkey}" \ --post-data='\r\n' \ --no-check-certificate \ -O auth2_fms_$channel \ https://radiko.jp/v2/api/auth2_fms if [ $? -ne 0 -o ! -f auth2_fms_$channel ]; then echo "failed auth2 process" exit 1 fi echo "authentication success" areaid=`perl -ne 'print $1 if(/^([^,]+),/i)' auth2_fms_$channel` echo "areaid: $areaid" rm -f auth2_fms_$channel # # get stream-url @@ -131,4 +136,8 @@ rtmpdump -v \ -W $playerurl \ -C S:"" -C S:"" -C S:"" -C S:$authtoken \ --live \ --stop $DURATION \ --flv "/tmp/${channel}_${date}" ffmpeg -y -i "/tmp/${channel}_${date}" -acodec libmp3lame -ab 128k "${outdir}/${channel}_${date}.mp3" rm -f "/tmp/${channel}_${date}" -
saiten revised this gist
Oct 24, 2012 . 1 changed file with 20 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/sh playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf playerfile=./player.swf keyfile=./authkey.png @@ -31,7 +31,7 @@ fi # get keydata (need swftool) # if [ ! -f $keyfile ]; then swfextract -b 14 $playerfile -o $keyfile if [ ! -f $keyfile ]; then echo "failed get keydata" @@ -106,13 +106,28 @@ echo "areaid: $areaid" rm -f auth2_fms # # get stream-url # if [ -f ${channel}.xml ]; then rm -f ${channel}.xml fi wget -q "http://radiko.jp/v2/station/stream/${channel}.xml" stream_url=`echo "cat /url/item[1]/text()" | xmllint --shell ${channel}.xml | tail -2 | head -1` url_parts=(`echo ${stream_url} | perl -pe 's!^(.*)://(.*?)/(.*)/(.*?)$/!$1://$2 $3 $4!'`) rm -f ${channel}.xml # # rtmpdump # rtmpdump -v \ -r ${url_parts[0]} \ --app ${url_parts[1]} \ --playpath ${url_parts[2]} \ -W $playerurl \ -C S:"" -C S:"" -C S:"" -C S:$authtoken \ --live \ -
saiten revised this gist
Apr 4, 2011 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ if [ ! -f $playerfile ]; then fi # # get keydata (need swftool) # if [ ! -f $keyfile ]; then swfextract -b 5 $playerfile -o $keyfile @@ -65,9 +65,9 @@ fi # # get partial key # authtoken=`perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)' auth1_fms` offset=`perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)' auth1_fms` length=`perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)' auth1_fms` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` @@ -101,7 +101,7 @@ fi echo "authentication success" areaid=`perl -ne 'print $1 if(/^([^,]+),/i)' auth2_fms` echo "areaid: $areaid" rm -f auth2_fms -
saiten created this gist
Mar 18, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,119 @@ #!/bin/sh playerurl=http://radiko.jp/player/swf/player_2.0.1.00.swf playerfile=./player.swf keyfile=./authkey.png if [ $# -eq 1 ]; then channel=$1 output=./$1.flv elif [ $# -eq 2 ]; then channel=$1 output=$2 else echo "usage : $0 channel_name [outputfile]" exit 1 fi # # get player # if [ ! -f $playerfile ]; then wget -q -O $playerfile $playerurl if [ $? -ne 0 ]; then echo "failed get player" exit 1 fi fi # # get keydata (need swftools) # if [ ! -f $keyfile ]; then swfextract -b 5 $playerfile -o $keyfile if [ ! -f $keyfile ]; then echo "failed get keydata" exit 1 fi fi if [ -f auth1_fms ]; then rm -f auth1_fms fi # # access auth1_fms # 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 if [ $? -ne 0 ]; then echo "failed auth1 process" exit 1 fi # # get partial key # authtoken=`cat auth1_fms | perl -ne 'print $1 if(/x-radiko-authtoken: ([\w-]+)/i)'` offset=`cat auth1_fms | perl -ne 'print $1 if(/x-radiko-keyoffset: (\d+)/i)'` length=`cat auth1_fms | perl -ne 'print $1 if(/x-radiko-keylength: (\d+)/i)'` partialkey=`dd if=$keyfile bs=1 skip=${offset} count=${length} 2> /dev/null | base64` echo "authtoken: ${authtoken} \noffset: ${offset} length: ${length} \npartialkey: $partialkey" rm -f auth1_fms if [ -f auth2_fms ]; then rm -f auth2_fms fi # # access auth2_fms # 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 if [ $? -ne 0 -o ! -f auth2_fms ]; then echo "failed auth2 process" exit 1 fi echo "authentication success" areaid=`cat auth2_fms | perl -ne 'print $1 if(/^([^,]+),/i)'` echo "areaid: $areaid" rm -f auth2_fms # # rtmpdump # rtmpdump -v \ -r "rtmpe://radiko.smartstream.ne.jp" \ --playpath "simul-stream" \ --app "${channel}/_defInst_" \ -W $playerurl \ -C S:"" -C S:"" -C S:"" -C S:$authtoken \ --live \ --flv $output