Last active
July 1, 2021 18:16
-
-
Save fcicq/fd5de9a677e012d06110 to your computer and use it in GitHub Desktop.
Recorder for showroom-live.com
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/bash | |
# coding: utf-8 | |
# showroomlive.sh by fcicq | |
(jq --version 1>/dev/null 2>&1) || (echo 'install jq first'; exit) | |
(livestreamer --version 1>/dev/null 2>&1) || (echo 'install livestreamer first (run pip/pip3 install livestreamer)'; exit) | |
if [ -n "$1" ]; then | |
id=$(echo "$1" | sed 's|^.*/||g') | |
while true; do | |
while true; do | |
(curl -s "https://www.showroom-live.com/room/is_live?room_id=$id" | grep "\"ok\":1") && break | |
echo "Not Alive, Sleeping $(date +'%F_%H-%M-%S')" | |
sleep 30 | |
done | |
fname="${id}_$(date +'%F_%H-%M-%S').ts" | |
# jq -r to strip "" | |
# HQ | |
# url=$(curl -s "https://www.showroom-live.com/room/get_live_data?room_id=$id" | jq -r '.streaming_url_hls') | |
# url=$(curl -s "https://www.showroom-live.com/room/get_live_data?room_id=$id" | jq -r '.streaming_url_list[0].url') | |
# LQ | |
url=$(curl -s "https://www.showroom-live.com/room/get_live_data?room_id=$id" | jq -r '.streaming_url_list[1].url') | |
livestreamer --hls-segment-threads 3 --hls-segment-timeout 1.5 --http-timeout 1.5 -o "$fname" "hlsvariant://$url" best | |
# ffmpeg -nostdin -i "$url" \ | |
# -vcodec copy -acodec copy -f mpegts "$fname" | |
if [ "$2" != "loop" ]; then | |
break | |
fi | |
done | |
else | |
echo "usage: $0 showroom_roomid (Note: roomid is not username)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment