Archive for the ‘Serverの構築と運用覚書き’ Category
6月30日からradikoの録音ができなくなった。
前回(2025/03/07)に加えて、再びshell script のなかのstream uriを設定する部分が変更されているようだった。
いろいろ調べてみると、uru2/radishで障害に対応するかたちで修正されていたので、ここで公開されているスクリプト radi.sh のradiko部分を借用するかたちで、いままでと同様な入出力になるようスクリプトを書き直した。
(続きを読む)
Posted in Serverの構築と運用覚書き | No Comments »
LetsEncrypt SSLの有効期限が10日後に迫ってきたので、いつもどおり更新作業を実施した。
以下、更新時のLog を転記:
[root@Server02 ~]# certbot certonly --manual
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): *.yamasnet.com
Renewing an existing certificate for *.yamasnet.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name:
_acme-challenge.yamasnet.com.
with the following value:
npctwQs-3KouQEJkRkEDimwxxco_Cl09UZI8vuDHpgU
Before continuing, verify the TXT record has been deployed. Depending on the DNS
provider, this may take some time, from a few seconds to multiple minutes. You can
check if it has finished deploying with aid of online tools, such as the Google
Admin Toolbox: https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.yamasnet.com.
Look for one or more bolded line(s) below the line ';ANSWER'. It should show the
value(s) you've just added.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/yamasnet.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/yamasnet.com/privkey.pem
This certificate expires on 2025-08-15.
These files will be updated when the certificate renews.
NEXT STEPS:
- This certificate will not be renewed automatically. Autorenewal of --manual certificates requires the use of an authentication hook script (--manual-auth-hook) but one was not provided. To renew this certificate, repeat this same certbot command before the certificate's expiry date.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(続きを読む)
Posted in Serverの構築と運用覚書き | No Comments »
Wednesday, March 26th, 2025
このブログ上に新規作成したポスト記事を、X(旧Twitter)に加えて、米新興SNSのBlueskyにも自動投稿できるようにした。Bluesky apiが公開され、PHPでの投稿ができそうなのでTwitterへの投稿機能を拡張した。
このところ、イーロン・マスクがXを私物化し、横暴な態度をとっていることから、Xの利用者がBlueskyへ乗り換えるが進んでいるようだ。日経電子版(3/11 配信)の記事「米SNSのBluesky、利用者4カ月で2倍 Xから乗り換え」もよると、利用者が急速に伸び3300万人にも達したとのことだ。
このブログ記事の要約をX同様にBlueskyにも投稿できるようにすることも多少の意味があるのでは考えた。
(続きを読む)
Posted in IT(情報処理), Serverの構築と運用覚書き | No Comments »
今年の1/20以降、radikoの録音ができなくなっていた。
障害発生の原因を調査したところ、原因がradikoの録音用 shell scriptのなかのstreaming urlの設定部分が変更されていることがわかった。
なお、認証部については、これまでと変化していない。
更新後のshell script の sourceは以下:
#!/bin/bash
LANG=ja_JP.utf8
pid=$$
date=`date '+%Y-%m-%d-%H:%M'`
outdir="."
if [ $# -le 1 ]; then
echo "usage : $0 channel_name duration(minuites) [outputdir] [prefix]"
exit 1
fi
if [ $# -ge 2 ]; then
channel=$1
DURATION=`expr $2 \* 60`
fi
if [ $# -ge 3 ]; then
outdir=$3
fi
PREFIX=${channel}
if [ $# -ge 4 ]; then
PREFIX=$4
fi
####
# Define authorize key value (from http://radiko.jp/apps/js/playerCommon.js)
RADIKO_AUTHKEY_VALUE="bcd151073c03b352e1ef2fd66c32209da9ca0afa"
if [ -f auth1_fms_${pid} ]; then
rm -f auth1_fms_${pid}
fi
#
# access auth1_fms
#
curl -s \
--header "pragma: no-cache" \
--header "X-Radiko-App: pc_html5" \
--header "X-Radiko-App-Version: 0.0.1" \
--header "X-Radiko-User: test-stream" \
--header "X-Radiko-Device: pc" \
--dump-header auth1_fms_${pid} \
-o /dev/null \
https://radiko.jp/v2/api/auth1
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_${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=`echo "${RADIKO_AUTHKEY_VALUE}" | dd bs=1 "skip=${offset}" "count=${length}" 2> /dev/null | base64`
echo "partialkey: $partialkey"
rm -f auth1_fms_${pid}
if [ -f auth2_fms_${pid} ]; then
rm -f auth2_fms_${pid}
fi
#
# access auth2_fms
#
curl -s \
--header "pragma: no-cache" \
--header "X-Radiko-User: test-stream" \
--header "X-Radiko-Device: pc" \
--header "X-Radiko-AuthToken: ${authtoken}" \
--header "X-Radiko-PartialKey: ${partialkey}" \
-o auth2_fms_${pid} \
https://radiko.jp/v2/api/auth2
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
#
if [ -f ${channel}.xml ]; then
rm -f ${channel}.xml
fi
curl -s "https://radiko.jp/v2/station/stream_smh_multi/${channel}.xml" -o ${channel}.xml
stream_url=`xmllint --xpath "/urls/url[@areafree='1'][2]/playlist_create_url/text()" ${channel}.xml`
#
echo "stream_url: $stream_url"
rm -f ${channel}.xml
#
# ffmpeg
#
ffmpeg \
-loglevel error \
-fflags +discardcorrupt \
-headers "X-Radiko-Authtoken: ${authtoken}" \
-i "${stream_url}" \
-acodec copy \
-vn \
-bsf:a aac_adtstoasc \
-y \
-t ${DURATION} \
"/tmp/${channel}_${date}.m4a"
ffmpeg -i "/tmp/${channel}_${date}.m4a" -acodec libmp3lame -ab 128k "${outdir}/${PREFIX}_${date}.mp3"
if [ $? = 0 ]; then
rm -f "/tmp/${channel}_${date}.m4a"
fi
Posted in Serverの構築と運用覚書き | No Comments »
Friday, December 27th, 2024
JupyterLabでJavascript(node.js)kernelを追加する際、どうもnodejsのversionによってはうまくいかないように思えた。
以下、解決する手続きがわかったような気がするのでメモしておいた。
前提として、Anaconda(version 24.1.2)を使用し、このうえでJupyterLabをインストールしている。
(続きを読む)
Posted in Serverの構築と運用覚書き | No Comments »