Skip to content

Instantly share code, notes, and snippets.

@ppalone
Created October 12, 2023 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppalone/c86b3ed6c1d1ff3ae2d114509d139efa to your computer and use it in GitHub Desktop.
Save ppalone/c86b3ed6c1d1ff3ae2d114509d139efa to your computer and use it in GitHub Desktop.
Extract
const link = `curl -H "Hs-Id: SSAI::A_U:D_NA:G_U:S_MH:M_PUN:N_NA:C1_1:C2_NA:C3_NA:C4_NA:C5_NA:C6_NA:C7_NA:C8_NA:C9_NA:C10_NA:C11_NA:C12_NA:C13_NA:C14_NA:C15_NA:P_P_AN" -H "hotstarauth: st=1697120728~exp=1697121328~acl=/*~hmac=33c9b2a5583084ca86c02f0948ef7bbde271d3a90638a5c56dae911f5e52b2e4" -H "User-Agent: Hotstar;in.startv.hotstar/23.09.29.2.9131 (Android/12)" -H "X-HS-Platform: android" -H "X-HS-Request-Id: 039e1db6-3d9f-46b5-a6ea-1aeabb6da4be" -H "X-HS-Device-Id: 15d2aaf7-6cad-42c9-a93b-4af8e4e47153" -H "Accept-Language: eng" -H "X-HS-Accept-Language: eng" -H "app_name: android" -H "X-HS-Client: platform:android;app_id:in.startv.hotstar;app_version:23.09.29.2;os:Android;os_version:12;schema_version:0.0.1017;brand:Xiaomi;model:M2010J19CI;carrier:JIO%204G;network_data:UNKNOWN" -H "X-HS-Schema-Version: 0.0.1017" -H "X-HS-Client-Targeting: ad_id:15d2aaf7-6cad-42c9-a93b-4af8e4e47153;user_lat:false;hw_id:95efeb4e249078c8" -H "X-HS-APP-ID: e161099e-445a-458f-ae8c-63a57d76f4a1" -H "X-HS-App: 9131" -H "capability: rewrite_segment_domain" -H "Host: live-ssai-cf-mum-ace.cdn.hotstar.com" --compressed "http://live-ssai-cf-mum-ace.cdn.hotstar.com/hls/live/2024723/inallow-icccwc-2023/eng/1540025190/15mindvrm01e9baeca5b49a4a819722433f0216336e12october2023/master_apmf.m3u8?playback_proto=http&playback_host=live11p-pristine-akt.cdn.hotstar.com&layer=master&random=inallow-icccwc-2023&content_id=1540025190&language=english&media_codec=h265&si_match_id=708808&a=s&ttl=86400&hdnea=exp=1697121321~acl=/hls/live/2024723/inallow-icccwc-2023/eng/1540025190/15mindvrm01e9baeca5b49a4a819722433f0216336e12october2023/master_apmf~ttl=86400~type=free~data=ip=dnuyNaJZhwn-userid=dnuyNaJZhwn-did=dnuyNaJZhwn-cc=in-~hmac=6afb4229b9adc3f77d99e9182c569fb5a5c8496a35340c8753c976cbbd06b289&Expires=1697121321&Signature=AlFBe~DQJ~GCLdUsNFN3dkn4w0IYBLII6O4QAvpcOL6PGY~8V-SNvqy2w4lvGgvw36Rm0CEH4L6mkx8mYSMexOnEBJenwzEyWJCtz4Guj6SzLbadrVXCmgRCyAvBvnhRMRKWOvdDMHoNBw88p1sPYLPe7UwNvccght8MM1ZjdZf6pOHBe9i53o1DTqJKJnjzjfywp7qhY~8MP1z2RKZTYD-2nTEEAgYUVIHGO~XQu2SWUPQ2BIT5llaKC4B67aouC1HmENG0tkSH7hVMjP6f3A0fZWuSONf0Dppx4TdLOaeZpSQcZIW759EufVzkSEhKHrnTw0lsdhHe1KnriSIWEw__&Key-Pair-Id=APKAJC3ILMJXG4AINKJA"`
const t = link.split(" --compressed ")
const p = t[t.length - 1]
const url = p.slice(1, p.length - 1)
// console.log(url)
const x = t[0].split(" -H ")
const headers = x.slice(1, x.length)
console.log(headers.length)
// console.log(headers.map(x => x.slice(1, x.length - 1)).join('\\r\\n'))
// console.log(headers.map(x => "-headers " + x).join(" "))
// const cmd = `ffmpeg -re ${headers.map(x => "-headers " + x).join(" ")} -i "${url}" -c copy -f flv rtmp://localhost/live/test`
// console.log(cmd)
const cmd = `ffmpeg -re -headers $'${headers.map(x => x.slice(1, x.length - 1)).join('\\r\\n')}' -i "${url}" -c copy -f flv rtmp://localhost/live/test`
console.log(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment