Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current version is not working. #1

Open
MarketingPip opened this issue Sep 18, 2024 · 6 comments
Open

Current version is not working. #1

MarketingPip opened this issue Sep 18, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@MarketingPip
Copy link
Member

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..

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 || [];

but not sure where to go from here.

@micahg
Copy link

micahg commented Sep 18, 2024

Hi, happy to help - which app is using this lib though?

@MarketingPip
Copy link
Member Author

@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!

@micahg
Copy link

micahg commented Sep 19, 2024

Who imports your lib?

@MarketingPip
Copy link
Member Author

MarketingPip commented Sep 19, 2024

@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.

@micahg
Copy link

micahg commented Sep 20, 2024

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.

@MarketingPip
Copy link
Member Author

MarketingPip commented Sep 20, 2024

@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) ;)

@MarketingPip MarketingPip added the bug Something isn't working label Sep 23, 2024
@MarketingPip MarketingPip self-assigned this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants