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

Reinstate UK Channel 5 (My5) #973

Closed
berkhornet opened this issue Oct 15, 2022 · 74 comments
Closed

Reinstate UK Channel 5 (My5) #973

berkhornet opened this issue Oct 15, 2022 · 74 comments

Comments

@berkhornet
Copy link

Would it be possible to reinstate the Live and Catch Up options for UK Channel 5 (My5)? Looking at the code it was previously available but is now disabled.

Many thanks.

I have a My5 account and would be happy to test if this were possible.

@joaopa00
Copy link
Contributor

My5 never worked.
Someone will have to understand how My5 api works.

@joaopa00
Copy link
Contributor

joaopa00 commented Oct 20, 2022

I coded the scraping of the videos. Unfortunately, license request is obfuscated completely. Likely, nobody will be able to fetch the useful datas to read the videos.
So don't take your breath for this issue. Surely, CUTVM will never support My5.

@berkhornet
Copy link
Author

berkhornet commented Oct 20, 2022 via email

@nictjir
Copy link
Contributor

nictjir commented Dec 28, 2022

I have managed to bulid the request to get the iv and data needed as input to the license.
Ie i can build a url like
https://cassie.channel5.com/api/v2/media/my5desktopng/C5278980003.json?timestamp=1672239512&auth=SLfBynOX8zGuzHyKeIRZqgeoayvn49HiFZWBIGqQvyw
From selecting an episode to watch and this successfully retrieves and iv and data.

I am struggling to find the number in the location of the mpd
eg https://hwdash.channel5.com/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd
I am struggling with where the 20200304115757 comes from

The C5278980003 comes from the episodes file eg:-
eg
https://corona.channel5.com/shows/5-mistakes-that-caught-a-killer/seasons/2/episodes.json?platform=my5desktop&friendly=1&linear=true
In here there is an id filed that contains
id : C5278980003

I am lost though as to how to feed this to inputstream.adaptive to get the actual video to play. I will keep tinkering but if anybody can help, taht would be great...

I have attached my working code - this runs under Kodi 18.9 on python2 ......

I will keep tinkering away, any input would be helpful and great!

channel5.txt

@joaopa00
Copy link
Contributor

joaopa00 commented Jan 4, 2023

20200304115757 should be the "CreatedAt" variable.
Can you check it is the value from decode64 variable Bearer in the header of the request of the file https://userservice-api.channel5.com/consent ?

@nictjir
Copy link
Contributor

nictjir commented Jan 7, 2023

I have managed to get the stream URL and License url - i just can't get the video to play :(
joapa00 could you possibly get this working please.

in get_video_url
Stream url is variable stream
License url is drmurl

2023-01-07 12:05:33.178 T:4583 NOTICE: Creating InputStream
2023-01-07 12:05:35.267 T:4583 NOTICE: Creating Demuxer
2023-01-07 12:05:35.360 T:4583 ERROR: Open - error probing input format, https://akadash0.akamaized.net/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd
2023-01-07 12:05:35.360 T:4583 ERROR: OpenDemuxStream - Error creating demuxer

I might be selecting the incorrect stream type, the streams available are listed in
getUseful(s):

for x in jsonData:
    for key, value in x.items():
        if key == 'keyserver':
                 licUrl.append(x['keyserver'])
        if key == 'renditions':
           for d in x['renditions']:
                 streamUrl.append(d['url'])
for u in licUrl:
    if "widevine" in u:
        widevine = u

for v in streamUrl:
    if "cenc" in v:

channel5.txt

@joaopa00
Copy link
Contributor

joaopa00 commented Jan 7, 2023

Looks like it is AES rijindael 128 bit crypto method. You have to use python Crypto library to implement it instead of reimplementing it in CUTVM. Anyway, I will try to make INPUTSTREAM Adaptive happy with that.

@nictjir
Copy link
Contributor

nictjir commented Jan 7, 2023 via email

@nictjir
Copy link
Contributor

nictjir commented Jan 7, 2023 via email

@berkhornet
Copy link
Author

@nictjir @joaopa00 many thanks for working on this. if you need any help with testing please let me know.

@nictjir
Copy link
Contributor

nictjir commented Jan 16, 2023

I am still struggling to get the license and stream to play.

@joaopa00 i see from
xbmc/inputstream.adaptive#1059
you had some luck in playing the stream.

Could you share how you did this? I am struggling to get the data (large binary data) taht is sent with the license request as seen in the browser.

I have attached my latests working version for Kodi 18.

I can get the stream url eg
https://hwdash.channel5.com/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd

The license call URL eg
https://cassie.channel5.com/api/v2/licences/widevine/208/C5278980003?expiry=1673965893&tag=33613932346433363837363735353361303534613534626363316662366232656537306531656562

but i can't get the stream to play :( I always get
2023-01-16 14:31:39.465 T:4637 NOTICE: Creating InputStream
2023-01-16 14:31:41.399 T:4637 NOTICE: Creating Demuxer
2023-01-16 14:31:41.591 T:4637 ERROR: Open - error probing input format, https://hwdash.channel5.com/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd
2023-01-16 14:31:41.591 T:4637 ERROR: OpenDemuxStream - Error creating demuxer

Thankyou for any help
channel5.txt

@joaopa00
Copy link
Contributor

joaopa00 commented Jan 16, 2023

For the video the house across the street / season 1/ episode 2
here is the working inputstream adaptive request
inputstream for my5.txt

@nictjir
Copy link
Contributor

nictjir commented Jan 16, 2023

Thankyou, let me work with that and see what i do. Much appreciated!

@nictjir
Copy link
Contributor

nictjir commented Jan 18, 2023

I have tried to mimic what @joaopa00 dose some amazing things) but I am still getting

2023-01-18 16:00:36.193 T:5883 ERROR : Open - error probing input format, https://hwdash.channel5.com/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd

To me it looks like the same call in the above file I have run out of ideas i think :(

here is my latest work, it now runs on Kodi 19 now with python3 to allow use of the resolver_proxy.get_stream_with_quality
channel5.txt

@nictjir
Copy link
Contributor

nictjir commented Jan 25, 2023

This version works for me on Kodi 18. It dose not have all the bells and whistles for showing the programs etc but at least shows play. Has some issues with things that don't have episodes in a series but video plays

I will try do the same for a Kodi 19 version , and i see Kodi 20
channel5.txt
release is out .....

@nictjir
Copy link
Contributor

nictjir commented Jan 27, 2023

I have fixed up the script for Kodi 18, i think all works now, including all menu selections
channel5.txt

If anybody is still on Kodi 18 and would like to test, i would appreciate any feedback.

I will make a working version for kodi 19 next week

@berkhornet
Copy link
Author

berkhornet commented Jan 27, 2023 via email

@nictjir
Copy link
Contributor

nictjir commented Jan 28, 2023

Cool. Here is a version taht runs for me on Kodi 20.

I see on the latest dev build of catch up tv, it references my5 as the file

So to use this file
Download my5.txt and rename the my5.txt that is here to my5.py

my5.txt

Put this file inside the plugin.video.catchuptvandmore-dev directory on android device.
For me the directory is
/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.catchuptvandmore/resources/lib/channels/uk/

Modify the plugin.video.catchuptvandmore-dev resources/lib/skeletons/uk_replay.py file, for me its the file
/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.catchuptvandmore/resources/lib/skeletons/uk_replay.py

And change this stanzana

"my5": { "route": "/resources/lib/channels/uk/my5:list_categories", "label": "My 5", "thumb": "channels/uk/my5.png", "fanart": "channels/uk/my5_fanart.jpg", "enabled": True, "order": 1, }, "my5": { "route": "/resources/lib/channels/uk/my5:list_categories", "label": "My 5", "thumb": "channels/uk/my5.png", "fanart": "channels/uk/my5_fanart.jpg", "enabled": True, "order": 1, },

Hope this makes sense

@nictjir
Copy link
Contributor

nictjir commented Jan 28, 2023

plugin.video.catchuptvandmore-dev.zip

If the above is gibberish i have rezipped the
plugin.video.catchuptvandmore-dev.zip
With my changes that i detailed above

To install this i had to remove the existing Catch TV and More and Catch TV and More Artwork addons and install this ZIP from a zip file

@nictjir
Copy link
Contributor

nictjir commented Jan 28, 2023

Some disclaimers
Starting video playback is a bit slow, the script dose lots of processing - have not found a way to use prebuilt functions for the encryption/decryption as yet but will keep trying
I can't get the new fancy resolver_proxy.get_stream_with_quality way of calling the inputstream.adaptive in Kodi 19/20 to work, so i just used the basic inputstream.adaptive with its parameters

I am having issues with live streams, on my browser when i go to a live streams i have the cirle with a trinagle play button but when i click on it nothing happens so I can't see the urls called to try and emulate, might be my vpn service, i am out of the UK. will see if i can get thsi to work as well, but if anybody can share the urls called for each live station, it would help

If anything is broken, and i can fix it, i will gladly do so, just shout.

thankyou for testing

@berkhornet
Copy link
Author

berkhornet commented Jan 28, 2023 via email

@berkhornet
Copy link
Author

berkhornet commented Jan 28, 2023 via email

@nictjir
Copy link
Contributor

nictjir commented Jan 29, 2023

Thankyou very much for your testing and feedback and logs - your testing is definitely more exhaustive than mine!
i think i have addressed all the issues you picked up. If you have the time if you can retest and report back.

Here is the my5 file
my5.txt

or the whole zip again to reinstall
plugin.video.catchuptvandmore-dev.zip

Again thankyou for the testing and log sharing

@berkhornet
Copy link
Author

No problem. I've retested and all the bugs I reported are fixed. I will now do a bit more detailed testing and report back

@berkhornet
Copy link
Author

In my further testing I just noticed a few minor issues:

  1. When selecting a category that has no sub-categories, any extra list just containing the category name has to be selected before the programmes are displayed. I detected this on the following categories:
  • Drama & Soaps
  • Milkshake!
  • Movies
  • News & Current Affairs
  • Real Lives
  • Sport
  1. Each list is limited to 10 items before the "Next Page" entry. Is it possible to increase the number of items to make it easier to scroll through long lists?
  2. Regarding live channels, I detected the following URLS

Hope this helps

@nictjir
Copy link
Contributor

nictjir commented Jan 30, 2023

Thankyou

Point 1 i noticed as well, I have been trying to think of a way around thsi, but so far nothing works. i will keep pondering. Seems like an easy thing to achieve but i just can't get the logic to work ....

For the limit, i have changed this to 25 in attached zip.
plugin.video.catchuptvandmore-dev.zip

For live channels tahnkyou for the list.
When i go to any of those or from the channrel5 home page on any of a range of browsers on my machine (i follow the web page in the browser debugger tools to see the links etc) all i get is
image
And if i click on the play button nothing happens. Not sure if this is an issue with my vpn provider or with channel5, but i will keep trying

Thankyou again for the feedback.

@berkhornet
Copy link
Author

Regarding the live URLs, they work for me, but I just realised that they only work when signed in with my account details

@nictjir
Copy link
Contributor

nictjir commented Jan 31, 2023

I am definitely logged in, tried a few different vpns and with all i get the same result, I can't play the live tv stations. You have a normal free channel5 account or do you have a paid for one? Unless i have been blacklisted ......

@berkhornet
Copy link
Author

berkhornet commented Jan 31, 2023 via email

@berkhornet
Copy link
Author

I just checked, the live channels are working here at the moment. Can you access the catch up content via the web browser?

@nictjir
Copy link
Contributor

nictjir commented Feb 13, 2023

Thankyou for checking

Just the two files above need changing.

I thought i needed to make a proxy to remove some MPD entries that were breaking inputstreamadapative so i tinkered with service.py in the root directory of the plugin but this is not needed

resources\lib\channels\uk\my5.py - this has changed code to play the live channels, they needed slightl changes to the catchup stuff to work

resources\lib\skeletons\uk_live.py - lists the channels and their artwork

@berkhornet
Copy link
Author

Hi. Looks like we could submit a PR to add My5 to the main release.

Before we do, I've added some code to my5.py to display the My5 artwork when browsing categories etc. Would you like to add it to your code? I could send you an updated my5.py file if so.

Also, I have some artwork for the live channels that I will add to the images addon

@nictjir
Copy link
Contributor

nictjir commented Feb 13, 2023

Add your my5.py file to here and a zip of the artwork. Then i need to learn how to do a PR :) or you can submit one :)

But i would like to see your additions and add them in to make things look prityer. Thankyou

@berkhornet
Copy link
Author

Here is the update to my5.py file. I have annotated the changes with a # MY5-001 comment above the change. I had to rename to my5.txt to upload here. I have already submitted a PR to the resource.images.catchuptvandmore addon for the My5 artwork referenced by these changes.
my5.txt

I will upload the live channel artwork soon

@berkhornet
Copy link
Author

and here is the artwork. I have uploaded .png and *_fanart.jpg versions for each channel. I think the addon only uses the .png format for live channels but I'm not 100% sure.
my5liveartwork.zip

@nictjir
Copy link
Contributor

nictjir commented Feb 13, 2023

Perfect. Nice changes, let me work out what to do to get a PR in and do it. Thankyou

@berkhornet
Copy link
Author

berkhornet commented Feb 13, 2023 via email

@joaopa00
Copy link
Contributor

As such, I will not merge the commit. I explain why. The aim is the stable release is accepted by the xbmc team in the official repo. They don't accept large duplicate code. And in this code, there are tons of duplicate. This duplicate code have to be removed by using the already existing libraries. The big part of the code is AES decrypting. So you will have to find how to use the cripto library.
Another solution is you fork CUTVM and you use your fork.

Sorry for the disturbance

@nictjir
Copy link
Contributor

nictjir commented Feb 13, 2023

Thankyou for the explanation. I will continue to try and work out how to use the AES libraries for this - up till now I have not been able to work this out but will continue working on it.

@nictjir
Copy link
Contributor

nictjir commented Feb 16, 2023

Thankyou @NeutralKaon.

All help will be greatly appreciated, i am just not working it out.

If you look in the my5.py/my5.txt program above there is a lot of computation that happens with a call to

part2(iv,aesKey,data)

"We" need to make this work with some call to a python crypto AES module, as opposed to my programs full computation

This could be AES rijindael 128

I have an example bellow of the inputs and the decrypted output.

AES Key
CTk+Z9wk/yx0DZdZRm6PTA==

IV
wkr3LuvyHxlh5bZ_vKQw5g==

Data
4TMI6aBhMyzIK9XCRTRPUgTdyQ1ihJDJyq62NlC4PrcfgNmlre_8clKgbGmMGlVpFmwodLrHpYrxBkVGbnLNO7jQvq263dQbv8mYhaB8WyguUAgIHkHzNvRnN_PueImXTQldm38qXyv2RekbUVIj2Vu5kKHXYixNYIHBWP7_Bgfrbo8uzfLhGGNakSx8OhPDDeY1Ghdm73Kb1FZ2V5a1uA-Shfxqg_eyAubhz1aXHuyJBQvD-pLnP0zYtbtnGixBUCzQmJpxUcgPAksqT3lvbKGLWX1YsL6py3b4m6wAnD6Rc7ToetHir24a-W9AfUgQSD05Q8DEjhMrpbH8Ebbg0v5lAOI0E-AA2rL_J368OSj6Or74XEJYypE-bqZ4ekyWXCNroDxTKPOTtR9lPVWlKhl9DnogCUutINuXVBvGfZyQDL60dwlnsxqTaw2dDzj3G47-UDlsKBj5aFS7pZ1KIa9OoKfaks9eyxRh0eZm7P8qAZj2Jb7wZ6ElnSubA7nSiOj2zVfQ0JyIOQL9hlzNanhwqaiymvG7wJu_-6AZYkOV-YDZqjz3wasXH2-3LsHIp4EsEzdlmnmfq7uWV0sYEKzW0rl19nBlH-A3wrq1zcrki4V5vUOWDVdcU9k9HfO2tNKUzNhckSbjGJuhZJmy70mBzCUMvtOJ3U99wEjguEQOG99xgoIG0ICks-keDOH2z4BkPcktc0iBCbztD6xLP2IzDEwug_TjQFSw5MfmKqP7dtKpWa4mUpw7Yiz2oUCzbuyRDTwgiXfmSyG5RTj3CH67ZVPZMLhfhNm7pqlhADH08OrumZFHheHhW9Te7u2lEfkdKFIWrCWnpO7lQ-T4QtC2qAcfW-9Wu8LM38ziWZReV5cDftXmvpRu4igTgBTwYxheCMuuGkuzuYRhzHA0kvmsiRKvPuEcmZmnbCjYXYEp38iKtCr-0fKqSt0iiPXYqqw-Ix-xf-csfJoT1HMKPU4cAf644-B-OoOEEEijaq3Bk8bfSpVHWnwh0kC4QEWcldwCwn0RUoJ1BtdnVZ3Dx__ekjwykUzkvALNI23D3Z4dgGNym-5zpqQK3LjOxl0hIgOZGH-9dD7z06_4EbCvdpFMNK8YufuGhnbajyE2fr-ff93FaWk837iAAQay8tB-l7P-eE5fU2XBIzaps0U9nmh0WlIgw3jjwR506NSadvV5sMLE5SZFzRIWl1t9cCuZ8-uwIOjh4lVf1n5aFO41kiYZOVjn-3TAChy01q_F00iLWlkuGfW3yjY5bdGqLyZhFjZjPOir5kKyXzRRKTqWUKpG5jdw8wnA5gO98k_ot1cYpWb_taYOGfu9Li5YRp8boOMUvm4JENMY6NE0iQchLLLHNVeq-VkTZiMtAzKWXnLmnLO8wxCpa_bhHY_1jcpBlqPG0_BDkBA_ZvV2OOTzJ18MZPEBPIRNMhzNm1Nz11x1RgStbJsmlZ4fqVBsZm29dbsZxZvTJly_qybTSBEzJgdcL1mF1LY3GsEVqyyTNuqYQdhILDF7so0DIL-s61no9MxdNDeKGzDd4bwZmQhmrg6EtILC4J-iUj91mnp_Mro2TlIcriCe3wPkx_GNoOYU2aaQg6L89ru8SEUyawuo_Hx2QNWWz5t8JNwsHZRTwp-WSDIOQW7mUjCZZIYTXdSByjeUIaww2Hej9yduexQklfiKV0lvCNRAUrlw2M4z0pr6cdRicP7kk4F_BBGILm-Ms3iYKJR2a9VM_zPPSq8UVegV7fFYgvwarAH_G095z99_3K4lqCrHZMWEugkpiEjRdDcYozEIWaVaHcgLIJOX3Cyy2hK1t8asfORvIickqShX1c07h_mUpZ_xvi0_q0uBqX5t0i4XGntjbH41VWT33L1b5SRgZfaT18ooe1LjTmAQ4kiIZ1LaB7Y8VbgrSkD9EtgjpDhtw8_TbQ9GpX-d492vu2-3QHeih66WoywGlakxs4ca_9Gqi5D1RX3oMXAcB35cS3rGUAaByCu7CO7w4pavCwdKA5iSNggomLwe0k1Sq3B9VjERHLa9l0FeBgLvT328OXEz1ezuIcL3ddOWmcWraPL0h3tfrxDXFstrcgVHxtv7Nh3enJT19_8EI-Z4_gcwBINIAjNdapGt40VNOeRHV5vI4jPaQzDDDwcZOqWuy2-3M_fVg16BnjwbMZ4cvFgsr3QYUpbUbxjB_8RRZTBH-SBhYPTtb0jmCv8S62Ml0f0QZSzzGjSTisYSyjhqeHWciUVXsOpCgGxm9Rf9l_4Ni6e5E09OSpbDmu5oWgPUt0vyQtTyLSZ-gQmhZfMFUy1O2sTbk_XAhnfYvqpXvRpjvVYr_ntTJL0ZPGabtfZD1jIuk2S3pW0Bzju4OVN4QmuqnU9KMzHBqFhJCvNP2I-xKaKBU_nNy7AfmTYx5F_D4E1t4T7_rz8EXYEd4cCAQBX6fAG0N-tVZwoTsnjS_1H25vwC4YSdT80T4fPajlir3GNrCeHYhCfeRSHQX1JGEhmBGoKkqfXu9CvdkY7k7Iuf7g90l4sKTguZcIiJO_1M48H9dsWt1qGZ2r71nB

When the data is decoded this string pops out

0{"id":"C5278980003","assets":[{"renditions":[{"renditionid":0,"format":"SD","bitrates":[160,360,480,800,1200,1500],"url":"https://hwdash.channel5.com/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd"}],"profile":"dash1","drm":"widevine","keyserver":"https://cassie.channel5.com/api/v2/licences/widevine/208/C5278980003?expiry=1676633142&tag=31386632333364623866323366373462366661663134373966393035643563616364333231626561","version":"A","subtitled":true,"subtitleurl":"https://akasubs.akamaized.net/webvtt/C5278980003/C5278980003A.vtt","thumbnailsurl":"https://akathumbnails.channel5.com/C5278980003A/thumbnails.vtt","audiodescribed":false,"duration":2707},{"renditions":[{"renditionid":0,"format":"SD","bitrates":[160,360,480,800,1200,1500],"url":"https://akadash0.akamaized.net/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd"}],"profile":"dash1","drm":"playready","keyserver":"https://playreadydrm.channel5.com/v2/rightsmanager.asmx?x=NjM3YjllMWQtODdlOS00M2U4LTk1MjYtODZkN2E3YzAzNDg4OzE2LzAyLzIwMjMgMTQ6MjU6NDI7TUgwUjhDNm5SdWJkL1hmekNJWlc5djVtZDUyUXRQNEdpZUw4SFpSU3hwUT07UFMz","version":"A","subtitled":true,"subtitleurl":"https://akasubs.akamaized.net/webvtt/C5278980003/C5278980003A.vtt","thumbnailsurl":"https://akathumbnails.channel5.com/C5278980003A/thumbnails.vtt","audiodescribed":false,"duration":2707},{"renditions":[{"renditionid":0,"format":"SD","bitrates":[160,360,480,800,1200,1500],"url":"https://hwhls.channel5.com/fps/C5278980003/C5278980003A/20200304115800/C5278980003A.m3u8"}],"profile":"fpshls1","drm":"fairplay","keyserver":"https://cassie.channel5.com/api/v2/licences/fairplay/220/C5278980003?expiry=1676633142&tag=61346461363766393931623665333464323138613362656261346164656164663064383863366465","version":"A","subtitled":true,"thumbnailsurl":"https://akathumbnails.channel5.com/C5278980003A/thumbnails.vtt","audiodescribed":false,"duration":2707}]}
{'id': 'C5278980003', 'assets': [{'renditions': [{'renditionid': 0, 'format': 'SD', 'bitrates': [160, 360, 480, 800, 1200, 1500], 'url': 'https://hwdash.channel5.com/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd'}], 'profile': 'dash1', 'drm': 'widevine', 'keyserver': 'https://cassie.channel5.com/api/v2/licences/widevine/208/C5278980003?expiry=1676633142&tag=31386632333364623866323366373462366661663134373966393035643563616364333231626561', 'version': 'A', 'subtitled': True, 'subtitleurl': 'https://akasubs.akamaized.net/webvtt/C5278980003/C5278980003A.vtt', 'thumbnailsurl': 'https://akathumbnails.channel5.com/C5278980003A/thumbnails.vtt', 'audiodescribed': False, 'duration': 2707}, {'renditions': [{'renditionid': 0, 'format': 'SD', 'bitrates': [160, 360, 480, 800, 1200, 1500], 'url': 'https://akadash0.akamaized.net/cenc/C5278980003/C5278980003A/20200304115757/C5278980003A-tt.mpd'}], 'profile': 'dash1', 'drm': 'playready', 'keyserver': 'https://playreadydrm.channel5.com/v2/rightsmanager.asmx?x=NjM3YjllMWQtODdlOS00M2U4LTk1MjYtODZkN2E3YzAzNDg4OzE2LzAyLzIwMjMgMTQ6MjU6NDI7TUgwUjhDNm5SdWJkL1hmekNJWlc5djVtZDUyUXRQNEdpZUw4SFpSU3hwUT07UFMz', 'version': 'A', 'subtitled': True, 'subtitleurl': 'https://akasubs.akamaized.net/webvtt/C5278980003/C5278980003A.vtt', 'thumbnailsurl': 'https://akathumbnails.channel5.com/C5278980003A/thumbnails.vtt', 'audiodescribed': False, 'duration': 2707}, {'renditions': [{'renditionid': 0, 'format': 'SD', 'bitrates': [160, 360, 480, 800, 1200, 1500], 'url': 'https://hwhls.channel5.com/fps/C5278980003/C5278980003A/20200304115800/C5278980003A.m3u8'}], 'profile': 'fpshls1', 'drm': 'fairplay', 'keyserver': 'https://cassie.channel5.com/api/v2/licences/fairplay/220/C5278980003?expiry=1676633142&tag=61346461363766393931623665333464323138613362656261346164656164663064383863366465', 'version': 'A', 'subtitled': True, 'thumbnailsurl': 'https://akathumbnails.channel5.com/C5278980003A/thumbnails.vtt', 'audiodescribed': False, 'duration': 2707}]}

If you can work out how to get to the result from the inputs with some a few lines of python using the crypto/Crypto.Cipher libraries

try:
from Crypto.Cipher import AES
except ImportError:
from Cryptodome.Cipher import AES

"WE" should be good to go .....

Thankyou!

@nictjir
Copy link
Contributor

nictjir commented Feb 16, 2023

Thanx for your enthusiasm.
The logic in the program comes from stepping through html5-c5-player.js in chrome developer tools line by line many times over and over again and translating the js stuff to python

If you have a uk IP address, you can run this attached python program taht will output the aes key, iv, data and the decoded form of the data.

c5.txt
If that dose not work i can repost the outputs

@nictjir
Copy link
Contributor

nictjir commented Feb 17, 2023

Buy that man a Bells!
Thankyou this works like a treat .... i have done a few iterations of testing and all looks golden!
I see in your decoding i also don't have the leading 0 which mine produced in the json string.

So my part2 now looks like

def part2(iv, aesKey, rdata):
realIv = padAndB64(mangle(iv))
realAesKey = padAndB64(mangle(aesKey))
realRData = base64.b64decode(mangle(rdata))
cipher = AES.new(realAesKey, AES.MODE_CBC, iv=realIv)
dataToParse=unpad(cipher.decrypt(realRData),16)
(stream, drmurl, sub) = getUseful(dataToParse.decode('utf-8'))
return (stream, drmurl, sub)

astring = str(dataToParse) dose not do what i think it should in python3, python3 needs the encoding type.


Now i need to remove all the extras i had in my code to manually do the decoding and remove any other extra crap and see if the version is neat enough to join CUTVM


Again thankyou, this is brilliant!

@nictjir
Copy link
Contributor

nictjir commented Feb 17, 2023

Funny you mentioned that, I was about to get to ask you about more work to do :)

There is another part of manual processing i do
Its in function
def getdata(ui)

After the info is pulled from the js file and processed, some magic/logic needs to happen to get the auth string to retrieve the auth key used in the url taht pulls the iv and data that have elegantly decoded for us. I think it might be some form of HMAC. Its not as clear as previous thing, i have updated c5.py to remove a lot of crap now and indicate where your next logic adventure is, look from line 315 in new c5.txt attached

c5.txt

if you have the time to solve this then we should be good to go ......

thankyou again!

@nictjir
Copy link
Contributor

nictjir commented Feb 17, 2023

Thankyou again, no rush
My day job dose not involve python or javascript at all :)

@joaopa00
Copy link
Contributor

joaopa00 commented Feb 17, 2023

Can't you use ljust method for null padding?

There is no easy way in python to xorify two strings. So I think the way you choosed is fine.

def url_parse(queryStr):
unicodestring=urllib.parse.unquote(queryStr)
return [ord(c) for c in unicodestring]

does not work?

@nictjir
Copy link
Contributor

nictjir commented Feb 18, 2023

Thankyou VERY much all for your suggestions.
I have cleaned up the code and got rid of unnecessaries i could find.

Here is a full zip of CUTVM and just the my5.py (as my5.txt)

plugin.video.catchuptvandmore-dev-ch5.zip

And the my5.txt
my5.txt

@berkhornet if you have the time, if you don't mind giving a test to see all still works as before. I have done some checking myself and all seems good.

If anybody is still using Kodi18, here is a version of my5.txt with all the crypto libraries etc that works on Kodi18
my5-KODI18.txt

@nictjir
Copy link
Contributor

nictjir commented Feb 18, 2023

I have updated the files above, as per your request.

@berkhornet
Copy link
Author

@nictjir I've installed the updated my5.py file and all has tested successfully. Many thanks to all who contributed to the development

@nictjir
Copy link
Contributor

nictjir commented Feb 19, 2023

Thankyou @berkhornet
I have created a fork and a pull request for the dev branch

@nictjir
Copy link
Contributor

nictjir commented Feb 19, 2023

The PR has failed with some errors that look to be a git hub thing i think
image

Not sure what to do next .....

@berkhornet
Copy link
Author

i think @joaopa00 has added comments on the actual pull request

@nictjir
Copy link
Contributor

nictjir commented Feb 19, 2023 via email

@nictjir
Copy link
Contributor

nictjir commented Feb 20, 2023

@berkhornet would you mind please retesting this update, i have tried to accomidate all the issues resulting in the pr not being accepted.

Alas the insertion of the My5 logo from local store as a a picie instead of the CUTVM logo had to be axed :(
I tried to find an image on the channel5 site to use - so i don't need to point to local storage, but could not find anything useful except for
https://api-images.channel5.com/otis/images/channel/C5/140x50.png
which dose not work well. If you can find one i will happily add it in.

Here is full zip again
plugin.video.catchuptvandmore-dev-ch5.zip

or just the my5 as a txt
my5.txt

Thankyou again.

@berkhornet
Copy link
Author

@nictjir all looks good apart from when selecting Documentaries category I get an IndexError. Extract from log:

2023-02-20 12:48:47.504 T:29688 error : [Catch-up-TV-&-More.support] list index out of range
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Roaming\Kodi\addons\script.module.codequick\lib\codequick\support.py", line 306, in run_callback
redirect = parent_ins(route, arg_params, self.callback_params)
File "C:\Users\xxx\AppData\Roaming\Kodi\addons\script.module.codequick\lib\codequick\route.py", line 196, in call
session_data = self._process_results(results)
File "C:\Users\xxx\AppData\Roaming\Kodi\addons\script.module.codequick\lib\codequick\route.py", line 210, in _process_results
listitems = validate_listitems(results)
File "C:\Users\xxx\AppData\Roaming\Kodi\addons\script.module.codequick\lib\codequick\route.py", line 39, in validate_listitems
raw_listitems = list(raw_listitems)
File "C:\Users\xxx\AppData\Roaming\Kodi\addons\plugin.video.catchuptvandmore\resources\lib\channels\uk\my5.py", line 240, in list_subcategories
item.label = root['filters']['contents'][i]['title']
IndexError: list index out of range

@nictjir
Copy link
Contributor

nictjir commented Feb 20, 2023

Thankyou @berkhornet for quick response.
The one thing i did not test, apologies an omission caused by making code flake8 happy

If you can retest please
my5.txt

plugin.video.catchuptvandmore-dev-ch5.zip

Thankyou gain

@berkhornet
Copy link
Author

berkhornet commented Feb 20, 2023 via email

@nictjir
Copy link
Contributor

nictjir commented Feb 20, 2023

Thankyou kindly!

@joaopa00
Copy link
Contributor

joaopa00 commented Mar 1, 2023

At least, the replay part is merged now.

@joaopa00
Copy link
Contributor

joaopa00 commented Mar 4, 2023

And now it is live. So this issue is fixed. Thanks to everybody for your hard work.

@joaopa00 joaopa00 closed this as completed Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants