Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
[NHKラジオ らじる★らじる](https://www.nhk.or.jp/radio/) / [radiko](http://radiko.jp/) / [ListenRadio](http://listenradio.jp/) / [渋谷のラジオ](https://shiburadi.com/) で現在配信中の番組を保存するシェルスクリプトです。なお配信形式と同じフォーマットで保存するため、別形式へのエンコードは行いません。


# ※重要なお知らせ

**2025-05-16を最後に更新停止します。**

作者自身も長らく利用しておらずここで一旦区切りをつけることにしました。<br>
今までご愛顧いただき、誠にありがとうございました。

特にradikoライブ配信のタイムラグが大きくなっている(放送局の財布事情が厳しいためオーディオアドを導入するのはいいですがあまりにラグが酷い)割には不定期に発生する対処のモチベーションを保つことができなくなっていました。<br>
(余程の理由がない限りタイムフリー保存のほうが速いですし、タイムラグもライブ配信と比べて遙かに小さいです)

またここ最近は音声配信という括りで番組のPodcast等への公開や各種プラットフォーム側でのタイムシフト機能の実装により、わざわざ実放送時間にリアルタイム保存する意義は薄れていっていることも理由の一つです。

オープンソースですので修正・機能追加などはforkしてぜひ公開してください。


## 必要なもの
- curl
- libxml2 (xmllintのみ使用)
Expand Down
6 changes: 4 additions & 2 deletions radi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ get_hls_uri_nhk() {
get_hls_uri_radiko() {
station_id=$1
radiko_login_status=$2
authtoken=$3

areafree="0"
if [ "${radiko_login_status}" = "1" ]; then
areafree="1"
fi

curl --silent "https://radiko.jp/v2/station/stream_smh_multi/${station_id}.xml" | xmllint --xpath "/urls/url[@areafree='${areafree}'][1]/playlist_create_url/text()" - 2> /dev/null
uri=$(curl --silent "https://radiko.jp/v3/station/stream/pc_html5/${station_id}.xml" | xmllint --xpath "/urls/url[@timefree='0' and @areafree='${areafree}'][playlist_create_url[not(contains(text(),'_definst_'))]][2]/playlist_create_url/text()" - | sed 's/\&amp;/\&/g' 2> /dev/null)
echo "${uri}?station_id=${station_id}&l=15&type=c&lsid="
}

#######################################
Expand Down Expand Up @@ -405,7 +407,7 @@ elif [ "${type}" = "radiko" ]; then
exit 1
fi

playlist_uri=$(get_hls_uri_radiko "${station_id}" "${radiko_login_status}")
playlist_uri=$(get_hls_uri_radiko "${station_id}" "${radiko_login_status}" "${radiko_authtoken}")
fi
if [ -z "${playlist_uri}" ]; then
echo "Cannot get playlist URI" >&2
Expand Down