Skip to content
/ onsengo Public

onsengo♨(音泉go) is a CLI program that allows listing and browsing radio shows on https://onsen.ag/. (音泉)

License

Notifications You must be signed in to change notification settings

Adios/onsengo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

onsengo♨(音泉go) is a CLI program that allows listing and browsing radio shows on https://onsen.ag/. (音泉)

It's written in Go, including a data wrapper library with command frontends that use it.

Onsen.ag website, since last refactoring, uses a server-side rendering which is very friendly to developers, we could get all the data with only one fetch. So the concept is easy:

  1. Every time when it needs the data, it requests to onsen.ag.
  2. Run the obfuscated Js code (dop251/goja) to get the data json.
  3. Parses data and creates a decorator to manipulate with.
  4. Cmd is implemented with spf13/cobra, and adios/pprint handles boilerplate typesetting.

onsengo♨ currently implements the following commands:

  • onsengo ls
  • onsengo lsm
  • onsengo dump

onsengo ls

onsengo ls can list radio shows and episodes on onsen.ag. Execute without arguments gives you all the radio programs the website current has:

~/w/onsengo ❯❯❯ ./onsengo ls
...
(omitted)
...
d--*--  4 Apr 13 2021 toshitai        セブン-イレブン presents 佐倉としたい大西
d--*--  4 Apr 13 2021 kakazu          かかずゆみの超輝け!やまと魂!!
d--*--  2 Apr 14 2021 vivy            Vivy -Flourite Eye’s Radio- 
d--*-- 33 Apr 14 2021 yuukiyui        ゆうきとゆいのラジオで2人暮らし♡
d--*--  8 Apr 14 2021 matsui          松井恵理子のにじらじっ!
d--*--  8 Apr 14 2021 frasta          笠間淳・梶原岳人のふらっと紀行! ~…え?スタジオからは出られないんですか?~
d--*--  8 Apr 14 2021 mushinobu_radio 東海オンエア虫眼鏡・島﨑信長 声YouラジオZ
d--*--  8 Apr 14 2021 jks             会沢紗弥と花井美春の「まったく、女子高生は最高だぜ!!」
d--*--  4 Apr 14 2021 nonpetit        MoeMiののんびりプティフール
d--*--  1 Apr 14 2021 llss            ラブライブ!サンシャイン!! Aqours浦の星女学院RADIO!!!
d--*--  4 Apr 14 2021 saibou          一緒に「はたらく細胞」らじお

onsengo ls -r gives you all radio shows and their episodes.

Provide names to list only selected radio shows and episodes:

~/w/onsengo ❯❯❯ ./onsengo ls fujita toshitai gurepap
d----- 8 Apr  8 2021 gurepap       鷲崎健・藤田茜のグレパラジオP
-r-*-- 1 Apr  8 2021 gurepap/3897  第40回 予告 # 日高里菜
---*+$ 1 Apr  8 2021 gurepap/3898  第40回 本編 # 日高里菜
-----$ 1 Mar 25 2021 gurepap/3736  第39回 予告 # 高森奈津美
----+$ 1 Mar 25 2021 gurepap/3737  第39回 本編 # 高森奈津美
-----$ 1 Mar 11 2021 gurepap/3569  第38回 予告 # あじ秋刀魚
----+$ 1 Mar 11 2021 gurepap/3570  第38回 本編 # あじ秋刀魚
-----$ 1 Feb 25 2021 gurepap/3353  第37回 予告 # 山下七海
----+$ 1 Feb 25 2021 gurepap/3354  第37回 本編 # 山下七海
d----- 8 Apr  9 2021 fujita        藤田茜シーズン1
-rv*-- 1 Apr  9 2021 fujita/3919   第83回 予告
--v*+$ 1 Apr  9 2021 fujita/3920   第83回 本編
--v--$ 1 Mar 26 2021 fujita/3765   第82回 予告
--v-+$ 1 Mar 26 2021 fujita/3766   第82回 本編
--v--$ 1 Mar 12 2021 fujita/3598   第81回 予告
--v-+$ 1 Mar 12 2021 fujita/3599   第81回 本編
--v--$ 1 Feb 26 2021 fujita/3383   第80回 予告
--v-+$ 1 Feb 26 2021 fujita/3384   第80回 本編
d--*-- 4 Apr 13 2021 toshitai      セブン-イレブン presents 佐倉としたい大西
-r-*-- 1 Apr 13 2021 toshitai/3946 第263回
-----$ 1 Apr  6 2021 toshitai/3873 第262回
-----$ 1 Mar 30 2021 toshitai/3796 第261回
-----$ 1 Mar 23 2021 toshitai/3708 第260回
  • drv*+$:
    • d: indicates the entry is a radio or episode
    • r: whether or not the current session can play the radio episode
    • v: includes video stream
    • *: just updated
    • +: extra content (sometimes extra is main content)
    • $: paid content
  • For radios, output is sort by upload date. (no perform sorting on episodes)

onsengo lsm

onsengo lsm can list each episode's manifest. By default, it lists all the manifests which are accessible by current session.

You can narrow down the result by specifying particular radio shows or episodes obtained from onsengo ls:

~/w/onsengo ❯❯❯ onsengo lsm fujita vivy/3958 --session SOME_LOGGED_PREMIUM_MEMBER
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202104/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202104/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202104/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202103/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202103/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202103/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202103/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202102/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202102/...(SCREENED).../playlist.m3u8
https://onsen-ma3phlsvod.sslcs.cdngc.net/onsen-ma3pvod/_definst_/202104/...(SCREENED).../playlist.m3u8

You can also filter radio episodes that were on-air on and after a given date:

~/w/onsengo ❯❯❯ go run . lsm --after 2021-04-16

The above command gives you all manifests you are able to play and they were updated after 2021-04-16 (including 2021-04-16).

onsengo dump

This command dumps raw data on the website into a json string. It can be passed to jq to be manually inspecting.

Global options

--backend: set a custom website url. If you have previously index.html archives, you can provide it like this:

onsengo ls --backend file:///full/path/to/index.html

--session: if you are a premium user, you could provide a session to the command:

onsengo ls --session SESSION_STRING_KEEP_IT_SECURE

A session string can be found in the cookie when you get logged-in and starts browsing onsen.ag.

  • Open a browser (Firefox as an example) to https://onsen.ag/, make sure you are logged in.
  • Open developer tool, reload the page
  • In the network tab, copy the first request to onsen.ag with "copy as cURL"
  • From the copied string, match the pattern _session_id=SESSION_STRING_KEEP_IT_SECURE without the _session_id= prefix.

Some use cases

Listen radio with vlc

onsengo lsm vivy | vlc -

With some helps by xargs & ffmpeg

onsengo lsm gurepa fujita | \
	xargs -I @ sh -c 'out=$(basename ${1%/playlist.m3u8}); ffmpeg -i $1 -codec copy $out' sh @

About

onsengo♨(音泉go) is a CLI program that allows listing and browsing radio shows on https://onsen.ag/. (音泉)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published