Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

とりあえず、for で uri を総なめするように書き換えてみた。 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 14 additions & 3 deletions radi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,24 @@ 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
urilist=$(curl --silent "https://radiko.jp/v2/station/stream_smh_multi/${station_id}.xml" | xmllint --xpath "/urls/url[@areafree='${areafree}']/playlist_create_url/text()" - 2> /dev/null)
for x in `echo $urilist`
do
ffprobe -v quiet -headers "X-Radiko-Authtoken: ${authtoken}" $x
if test $0
then
echo $x
return 0
fi
echo
done
return 1
}

#######################################
Expand Down Expand Up @@ -405,7 +416,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