blinkpy icon indicating copy to clipboard operation
blinkpy copied to clipboard

get_liveview() returns a immis protocol link

Open IanTrudel opened this issue 5 years ago • 25 comments

get_liveview() returns a immis link on an XT2 camera instead of an rtsps link. The only information on the protocol that I could find is on https://github.com/lurume84/bling-desktop/issues/26. Any (other) way to access the stream?

IanTrudel avatar Jul 26 '20 19:07 IanTrudel

Not that I'm aware, sorry

fronzbot avatar Jul 26 '20 20:07 fronzbot

get_liveview() return the following for me on a xt2 ,

.local/lib/python3.6/site-packages/blinkpy/camera.py", line 204, in get_liveview
    return response["server"]
KeyError: 'server'

Also tried this: blinkpy.api.request_camera_liveview( blink, ... Got the following in return: {'message': 'An app update is required'}

any ideas?

e-team-t avatar Aug 05 '20 03:08 e-team-t

Yeah looks like the API endpoint changed. This guy figured it out recently so looks like that link just needs to be updated: https://github.com/lurume84/bling-viewer/commit/499f39339a225a2325fbe91cd64869ff5feb3e0d#diff-a55f5692772dd8c93564ed9c3e86ba99

fronzbot avatar Aug 05 '20 03:08 fronzbot

I changed line 248 of the api.py file to the following:

f"{blink.urls.base_url}/api/v5/accounts/{blink.account_id}/networks/{network}/cameras/{camera_id}/liveview"

and it is working fine, I am getting the immis link.

e-team-t avatar Aug 05 '20 03:08 e-team-t

Awesome! Feel free to make a pull request if you'd like. Otherwise I'll get that in some time this week

fronzbot avatar Aug 05 '20 11:08 fronzbot

Since the pull request was merged to dev I assumed that I could retrieve the liveview url via get_liveview. But I've trouble streaming it.

The server responds with { 'command_id': 91342095, 'join_available': True, 'join_state': 'available', 'server': 'immis://3.123.232.171:443/abcdef01234567890__IMDS_G8T11234513512B9?client_id=52265', 'duration': 300, 'continue_interval': 60, 'continue_warning': 10, 'submit_logs': True, 'new_command': True, 'media_id': None, 'options': { 'poor_connection': False } }

The method returns rstps//3.123.232.171443/abcdef01234567890__IMDS_G8T11234513512B9?client_id=52265, which is due to improper replacing of immis. But anyway, I cannot get players like vlc to stream the link rstp://3.123.232.171:443/abcdef01234567890__IMDS_G8T11234513512B9?client_id=52265.

Can anyone assist with this?

cee-dee avatar Oct 25 '20 09:10 cee-dee

Full disclosure: I've never actually tested the method, just added it in because I saw the endpoint was there. Good catch on the game incorrect link formatting, I'll have to fix that!

Anyways, I'll try to test this today to see what my results are. It's possible the endpoint changed again and we're using a stale url.

fronzbot avatar Oct 25 '20 12:10 fronzbot

Yeah I'm struggling to get this to work too. Not sure what the solution is

fronzbot avatar Oct 25 '20 15:10 fronzbot

Do you have a working livestream with another camera? Can you see the network traffic on that protocol? Maybe it differs from the working version by some kind of custom header?

cee-dee avatar Oct 26 '20 17:10 cee-dee

No I don't. Your hunch is probably a good one, but I'm ill-equipped to do any network sniffing, unfortunately

fronzbot avatar Oct 28 '20 02:10 fronzbot

Maybe there are ways to work work with an Android emulator to get insights in the traffic, see https://developer.android.com/studio/profile/network-profiler

But I haven't worked with that yet.

cee-dee avatar Oct 29 '20 18:10 cee-dee

Are you all able to view a live stream from your blink mini or outdoor cams?

Hello @fronzbot! Firstly, Thanks you soo much for this library. I am able to download my images now.

For get_liveview() I think I fixed a small issue in the camera.py: https://github.com/fronzbot/blinkpy/blob/014509bd6421152bfa18334b2eeb7a905ffede66/blinkpy/camera.py#L269

server_split[0] = "rtsps:" link = "".join(server_split) to server_split[0] = "rtsps" link = ":".join(server_split)

With this I get the link as: rtsps://52.34.34.83:443/NBl17cWGk61xIJKy__IMDS_G8T1900001642F9F?client_id=57905

But I am not able to view it. Any help will go a long way!

foxm79 avatar Jan 15 '21 02:01 foxm79

Did anyone figure this out? I see the "liveview" rest api returns 'join_available': True, 'join_state': 'available', among other things, maybe the cam has to be "joined" in order for the stream to work?

esistgut avatar Jun 02 '23 21:06 esistgut

Hello, any update on this?

KiraPC avatar Oct 10 '23 13:10 KiraPC

Unfortunately, no. The protocol Blink uses appears to be proprietary and unless someone is able to crack it, anything with an immis link will be unviewable.

fronzbot avatar Oct 10 '23 15:10 fronzbot

any updates?

simon2022 avatar Dec 06 '23 01:12 simon2022

any updates?

I downloaded the file "Blink Home Monitor_27.0_Apkpure.apk" and patched it with apk-mitm --keep-tmp-dir Blink\ Home\ Monitor_27.0_Apkpure.apk ( https://github.com/shroudedcode/apk-mitm )strings libwalnut.so | grep immis as I kept the tmp dir i'm able to navigate to it: cd /tmp/apk-mitm-c08e4858c726d3cf7a351d94fe5ad834/decode/lib/x86_64 and do a strings libwalnut.so | grep immis IMMIStreamSource can only operate on immis: URLs immis Receiving data after disconnect. immistreamsource._connectionState = %d I think this is the library which is doing the imms stuff. But unfortinuately my know how is not enought to analyze it deeper or to remove the ssl pining out of the library, so I could see unencrypted what's happening there.

All other calls to the API are now visible with PCAPDROID ( https://play.google.com/store/apps/details?id=com.emanuelef.remote_capture&hl=de&gl=US ) and the mitm binary which this tool can download.

Maybe there is someone out there who can analyze the details - I hope this helps.

MaUwJo avatar Feb 18 '24 10:02 MaUwJo