Open MarketingPip opened 1 month ago
Hi, happy to help - which app is using this lib though?
@micahg - not to sure if you mean any existing "users" etc.... Tho previous it was working in a browser side environment. Meaning it should work on any JS engine with fetch / network capability. (Previous version was - since no CORS issues).
Thank you for quick reply too!
Who imports your lib?
@micahg - if you are implying how many people use it. I do not have this currently published on NPM so no way to track dependencies / projects using this. But you are welcome to look here to see some requests made to this library. (Which is little).
But I built this for myself - to fetch the stream URLs in JS. (So I can use for my own purposes - entertainment wise). As well published it on GitHub so people could do with it as they please etc.
Yeah, I just figured there would be a consuming front-end app I could try out -- Kodi has issues playing back some of their widevine encrypted streams and TBH I'm wondering if there is a better 10-foot experience out there...
Anyway, have a look at https://github.com/micahg/plugin.video.cbc/blob/feat/catalog_v2/test.py#L56-L77https://github.com/micahg/plugin.video.cbc/blob/feat/catalog_v2/test.py#L56-L77 -- that branch has the updated API calls and that code block in particular shows the calls in order.
@micahg - you are a G.
Guess they blocked second request (meaning no more browser based support unless using CORS proxy). But... that said - I managed to figure things out after you sent me that lol!
<script type="module">
const LIST_ELEMENT = "2415871718";
let data = await fetch(
"https://services.radio-canada.ca/ott/catalog/v2/gem/home?device=web"
);
data = (await data.json()).lineups.results;
const items = data.find((result) => result.key === LIST_ELEMENT)?.items || [];
async function getChannelStream(id) {
const url = `https://services.radio-canada.ca/media/validation/v2/?appCode=medianetlive&connectionType=hd&deviceType=ipad&idMedia=${id}&multibitrate=true&output=json&tech=hls&manifestType=desktop`;
try {
const response = await fetch(url);
if (!response.ok) {
console.error(`ERROR: ${url} returns status of ${response.status}`);
return null;
}
const data = await response.json();
return data.url;
} catch (error) {
console.error('Fetch error:', error);
return null;
}
}
console.log(await getChannelStream(await items[0].idMedia))
</script>
My bad too - I thought you meant like how many people are using it? I was like - why does that matter ._. lol
Thank you @micahg - if ever near GB do let me know! ps; you're more than welcome to commit to this repo (if you want to - I mean obviously) ;)
The current version of this library is not working. I am hoping I can possibly get some help from someone who helped inspire this library.
@micahg - I am reaching out in here - hoping maybe you can guide me if this is doable still on browser side without auth etc...
Tried reading through your code for the Kodi plugin but - not sure if I can avoid auth to get the stream url.
I know this works without any CORS issues etc..
but not sure where to go from here.