Skip to content

Instantly share code, notes, and snippets.

@xnuk
Created February 19, 2018 13:17
Show Gist options
  • Save xnuk/6becafa48ab89217e9804ce517fe3dd9 to your computer and use it in GitHub Desktop.
Save xnuk/6becafa48ab89217e9804ce517fe3dd9 to your computer and use it in GitHub Desktop.
https://myk.kbs.co.kr/ 들어가서 콘솔창 열고 실행시키고 TV 온에어 메뉴에서 보실 방송 선택하시면 rtmp 미디어 주소를 얻을 수 있습니다 그걸 동영상 플레이어에서 여세요
const pk_token = document.getElementsByName('pk_token')[0].value
var dafuq = {}
fetch('https://myk.kbs.co.kr/broadcast_live/channel_master_items_json', {
method: 'POST',
body: new URLSearchParams('src_channel_type=&os_type=pc&pk_token=' + pk_token),
credentials: 'same-origin', // for use cookie
keepalive: true
}).then(v => v.json()).then(channels =>
channels.live_episode_items.forEach(v => {
const info = v.normal_stream_info
const url = info && info.service_url
const code = v.channel_code.value
dafuq[code] = {type: v.channel_type, url}
})
)
window.channel_selection_ajax = code => {
const {type, url} = dafuq[code]
const body = new URLSearchParams()
body.set('service_url', url)
body.set('channel_code', code)
body.set('channel_type', type)
body.set('isPopup', false)
body.set('pk_token', pk_token)
fetch('https://myk.kbs.co.kr/api/kp_cms/live_stream', {
method: 'POST',
body,
credentials: 'same-origin',
keepalive: true
}).then(v => v.json()).then(v => window.prompt('Copy this!', v.real_service_url))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment