chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 581 forks source link

403 Client Error: Forbidden - Need some help to get this to work. #1262

Open Alex2504 opened 8 years ago

Alex2504 commented 8 years ago

Hi, i'm trying to watch this stream with livestreamer but i get this error:

livestreamer "hlsvariant://https://srgssruni13ch-lh.akamaihd.net/i/enc13uni_ch@191855/master.m3u8" best
[cli][info] Found matching plugin stream for URL hlsvariant://https://srgssruni13ch-lh.akamaihd.net/i/enc13uni_ch@191855/master.m3u8
error: Unable to open URL: https://srgssruni13ch-lh.akamaihd.net/i/enc13uni_ch@191855/master.m3u8 (403 Client Error: Forbidden)

Please note that you need a Swiss proxy to watch the stream on the website.

Here are some more info about the stream:

Webpage: http://www.rsi.ch/play/tv/live?channelId=LA1#?tvLiveId=livestream_La2&index=all HTTP-HDS - http://srgssruni13ch-lh.akamaihd.net/z/enc13uni_ch@191855/manifest.f4m HTTP-HLS - https://srgssruni13ch-lh.akamaihd.net/i/enc13uni_ch@191855/master.m3u8 http://pastebin.com/8NDEAaQv

I got this url sniffing with Url Helper, i don't know if it's usefull:

http://srgssruni13ch-lh.akamaihd.net/i/enc13uni_ch@191855/segment243152152_1200_av-p.ts?sd=6&rebase=on&id=AgAfBzh02ZKlhX0+9VbUfxBsY3cSgMmFXIfeb0S%2ftitxFa99wc0J6fh5lW94O0pORTkoYycZWy4ILw%3d%3d&hdntl=exp=1458999293~acl=/i/enc13uni_ch@191855/*~data=hdntl~hmac=3d483bbd42cb3c2cb43cefda5ca712db62fee4f0f4800699d4c1b54a6f1f17a6

I tried with the protocols hds:// hls:// hlsvariant:// without luck. All the attempts have been made using Tunnelbear Vpn connected to Switzerland.

Thank you

tp0 commented 8 years ago

(Yet another new comment instead of edit, incase you see these via email... :D)

Try to sniff the URL again (hint: browser dev tools & network tab is enough) and get this instead:

http://srgssruni13ch-lh.akamaihd.net/z/enc13uni_ch@191855/manifest.f4m?hdnts=exp%3D1459094735~acl%3D%2Fz%2Fenc13uni_ch%40191855%2F*~hmac%3Db80eb816ae0dfb876af47d9bcbbf0602ce5738e623b5b60f728123b91c1f0dd7&g=RXVYYEUTNHXI&hdcore=3.7.0&plugin=aasp-3.7.0.39.44

The try this sort of format:

livestreamer "hds://URL_LIKE_ABOVE_HERE pvswf=URL_TO_FLASHPLAYER.swf" best

Find the flash player path from page source or via dev tools. I can't test this anyway as I only have Tunnelbear browser addon.

Alex2504 commented 8 years ago

Hi, thank you for your reply. I did everything you said and this is the url i came up with:

livestreamer "hds://http://srgssruni13ch-lh.akamaihd.net/z/enc13uni_ch@191855/manifest.f4m?hdnts=exp%3D1459100159~acl%3D%2Fz%2Fenc13uni_ch%40191855%2F*~hmac%3Dc43b03037003c4827780161570c98f77a32868537c75b3e2c9bd0fbb0cc9c003&g=UEULYIOOUCRK&hdcore=3.7.0&plugin=aasp-3.7.0.39.44 pvswf=http://tp.srgssr.ch/p/bower_components/videojs-osmf/dist/videojs-osmf.70c482fe.swf" best Livestreamer still says 403 Client Error: Forbidden

Then i noticed that entering this url (found in the dev tools & network tab) in the browser:

http://players.edgesuite.net/flash/analytics/qos/v1.3.1/data.swf

it redirects me to some sort of "anti thief" protection. I think i'll have to give up.

Thanks again :D

tp0 commented 8 years ago

I think the first swf path looks right. Do you do this quickly enough? Sometimes the cookie can expire really quickly.

Alex2504 commented 8 years ago

You were right!

livestreamer "hds://http://srgssruni13ch-lh.akamaihd.net/z/enc13uni_ch@191855/manifest.f4m?hdnts=exp%3D1459165949~acl%3D%2Fz%2Fenc13uni_ch%40191855%2F*~hmac%3D876a73babe17d3db3cfd74c9ee7158363117b9338e8306012ee7b9407a908187&g=PXNQCYHKKCBX&hdcore=3.7.0&plugin=aasp-3.7.0.39.44 pvswf=http://tp.srgssr.ch/p/bower_components/videojs-osmf/dist/videojs-osmf.70c482fe.swf" best
[cli][info] Found matching plugin stream for URL hds://http://srgssruni13ch-lh.akamaihd.net/z/enc13uni_ch@191855/manifest.f4m?hdnts=exp%3D1459165949~acl%3D%2Fz%2Fenc13uni_ch%40191855%2F*~hmac%3D876a73babe17d3db3cfd74c9ee7158363117b9338e8306012ee7b9407a908187&g=PXNQCYHKKCBX&hdcore=3.7.0&plugin=aasp-3.7.0.39.44 pvswf=http://tp.srgssr.ch/p/bower_components/videojs-osmf/dist/videojs-osmf.70c482fe.swf
[cli][info] Available streams: 1328k (best), 147k (worst), 347k, 664k
[cli][info] Opening stream: 1328k (hds)
[stream.hds][error] Unknown tag type found, this stream is probably encrypted
[cli][error] No data returned from stream

It worked but it says "this stream is probably encrypted" Thanks

ghost commented 8 years ago

Switch to HLS.

livestreamer "hlsvariant://https://srgssruni13ch-lh.akamaihd.net/i/enc13uni_ch@191855/master.m3u8?hdnts=exp=1459417115~acl=/i/enc13uni_ch@191855/*~hmac=d3adfb4202873d0a19136f1fec90dd77c27a7804f285470ed5dc2a3fe8be4cd7" best
[cli][info] Found matching plugin stream for URL hlsvariant://https://srgssruni13ch-lh.akamaihd.net/i/enc13uni_ch@191855/master.m3u8?hdnts=exp=1459417115~acl=/i/enc13uni_ch@191855/*~hmac=d3adfb4202873d0a19136f1fec90dd77c27a7804f285470ed5dc2a3fe8be4cd7
[cli][info] Available streams: 48k (worst), 180p, 272p, 288p, 360p (best)
[cli][info] Opening stream: 360p (hls)
[cli][info] Starting player: "C:\Program Files (x86)\Video\MPC-HC\mpc-hc.exe"
Video: MPEG4 Video (H264) 640x360 25fps [V: h264 main L3.0, yuv420p, 640x360]
Audio: AAC 44100Hz stereo 127kbps [A: aac lc, 44100 Hz, stereo, 127 kb/s]
Alex2504 commented 8 years ago

Hi i am a total newb but i am trying to learn. Would you be so kind to tell me where did you find this string?

hdnts=exp=1459417115~acl=/i/enc13uni_ch@191855/*~hmac=d3adfb4202873d0a19136f1fec90dd77c27a7804f285470ed5dc2a3fe8be4cd7

I'm trying to use take the values from this url:

http://srgssruni13ch-lh.akamaihd.net/z/enc13uni_ch@191855/manifest.f4m?hdnts=exp=1459433689~acl=/z/enc13uni_ch@191855/*~hmac=1a7bafc993a4963e06f7021880846b02df1bd82382979e8b4cd7051a7a01370d&g=HVRHKIUPDIMO&hdcore=3.7.0&plugin=aasp-3.7.0.39.44

but it doesn't work.

Thanks

scottbernstein-zz commented 8 years ago

The problem is that the parameter "exp=1459417115" is an expiration date and time -- in unix "Epoch time" (see here to convert to real time: http://www.epochconverter.com/) -- in this case Thu, 31 Mar 2016 14:14:49 GMT. Once that time passes, the URL will no longer work (it will return a 403 response).

You would need to request the video again and use the new URL generated (with new timestamp) for livestreamer.

ghost commented 8 years ago

You can use this link to get your own authentication parameters.

http://tp.srgssr.ch/akahd/token?acl=/i/enc13uni_ch@191855/*
{"token":{"window":30,"acl":"/i/enc13uni_ch@191855/*","authparams":"hdnts=exp=1459442736~acl=/i/enc13uni_ch@191855/*~hmac=0d7833b1d03c1d634e37b5f629719cece89e21565d8ca954b43b8a1c2b08ff20"}}
Alex2504 commented 8 years ago

It works! Thank you guys.

Is there a way to automatically renew the cookie when it times out?

scottbernstein-zz commented 8 years ago

No

Date: Fri, 1 Apr 2016 02:53:39 -0700 From: notifications@github.com To: livestreamer@noreply.github.com CC: scott_bernstein@hotmail.com Subject: Re: [chrippa/livestreamer] 403 Client Error: Forbidden - Need some help to get this to work. (#1262)

It works! Thank you guys.

Is there a way to automatically renew the cookie when it times out?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

besweeet commented 8 years ago

With hds://, I'm also getting "this stream is probably encrypted:"

livestreamer "hds://[link to f4m here, similar to the one above] pvswf=[link to swf here]" best
[cli][info] Found matching plugin stream for URL hds://f4m pvswf=swf
[cli][info] Available streams: 264k (worst), 414k, 614k, 914k, 1414k, 2264k, 3564k (best)
[cli][info] Opening stream: 3564k (hds)
[stream.hds][error] Unknown tag type found, this stream is probably encrypted
[cli][error] No data returned from stream

Several SWF's are found on the page (screenshot here). I tried all of them, and the results were the same.

If I use hlsvariant://, akamaihd:// or hls://, I get the usual 403 forbidden error, despite switching back to hds:// getting to the same spot above, so the file didn't expire. I tried hlsvariant:// again by uploading the f4m to a local server, and it now says:

error: Failed to parse playlist: Missing #EXTM3U header

I can see Firefox pulling in all the encrypted f4f video files, which obviously can't be played anywhere.

BTW, I'm trying to get FXX online (here) to play. Would also like to get TWCTV working, but that's a different beast it seems.

ghost commented 8 years ago

Please, can anyone help me to download videos from a site a have a login and key to acess. I bought some video classes , but I can only watch them online, and I would like to have a backup of this material to be able to review.

Part of the source code of the page:

var media = ""; var urlHTML5 = "https://cers1hls-vh.akamaihd.net/i/video/AAAAAA/100153/,REC_3659_122115_DIR_PENAL_AULA_01_PT_IV_OK-v2-240p,.mp4.csmil/master.m3u8?hdnea=exp=1468204147~acl=/*~id=-ONTkOmWxIjKwwlbnjbItbp3.sp-tucson-prod-10~hmac=a23c9af57b3c5dc74e5060c49588998fd1586977d1e3d390982ff510c1adfa18"; var urlFlash = "http://cers1hds-vh.akamaihd.net/z/video/AAAAAA/100153/,REC_3659_122115_DIR_PENAL_AULA_01_PT_IV_OK-v2-720p,REC_3659_122115_DIR_PENAL_AULA_01_PT_IV_OK-v2-480p,REC_3659_122115_DIR_PENAL_AULA_01_PT_IV_OK-v2-240p,.mp4.csmil/manifest.f4m?hdnea=exp=1468204147~acl=/*~id=-ONTkOmWxIjKwwlbnjbItbp3.sp-tucson-prod-10~hmac=a23c9af57b3c5dc74e5060c49588998fd1586977d1e3d390982ff510c1adfa18"; var divId = "player";

if ((media != null && media.length > 0) || (urlHTML5 != null && urlHTML5.length > 0) || (urlFlash != null && urlFlash.length > 0)) {

I've tried limestream...

Microsoft Windows versão 6.2.9200 2012 Microsoft Corporation. Todos os direitos reservados.

C:\Windows\system32>livestreamer "https://cers1hls-vh.akamaihd.net/i/video/AAAAA A/100153/,REC_3659_122115_DIR_PENAL_AULA_01_PT_IVOK-v2-240p,.mp4.csmil/master.m 3u8?hdnea=exp=1468204147~acl=/~id=-ONTkOmWxIjKwwlbnjbItbp3.sp-tucson-prod-10~hm ac=a23c9af57b3c5dc74e5060c49588998fd1586977d1e3d390982ff510c1adfa18" best error: No plugin can handle URL: https://cers1hls-vh.akamaihd.net/i/video/AAAAAA /100153/,REC_3659_122115_DIR_PENAL_AULA_01_PT_IVOK-v2-240p,.mp4.csmil/master.m3 u8?hdnea=exp=1468204147~acl=/~id=-ONTkOmWxIjKwwlbnjbItbp3.sp-tucson-prod-10~hma c=a23c9af57b3c5dc74e5060c49588998fd1586977d1e3d390982ff510c1adfa18

What can i do??

Hulipill commented 7 years ago

After trying and trying, I found out that you have to get the "master" .m3u8 file. This is found in the page's main.css file when it loads and contains a cookie/token that allows you to view the file. Just download the file as ".har" by inspecting element, and filtering to see only .css files. Go into notepad++ and find "master.m3u8" and copy the whole url which is underlined. In livestreamer the code should look like this: livestreamer "hlsvariant://https://**.akamaihd.net/i/**/**/40,25,18,12,7,4,2,00.mp4.csmil/master.m3u8?****[LONG KEY]****" best -o 01.ts

PlaceboPRS commented 5 years ago

After trying and trying, I found out that you have to get the "master" .m3u8 file. This is found in the page's main.css file when it loads and contains a cookie/token that allows you to view the file. Just download the file as ".har" by inspecting element, and filtering to see only .css files. Go into notepad++ and find "master.m3u8" and copy the whole url which is underlined. In livestreamer the code should look like this: livestreamer "hlsvariant://https://**.akamaihd.net/i/**/**/40,25,18,12,7,4,2,00.mp4.csmil/master.m3u8?****[LONG KEY]****" best -o 01.ts

Two years later and your post helped me resolve issues I was having with Hayu, thank you so much! I realise I'm probably breaking some rules replying after all this time buy your post deserved thanks :)

sahil129 commented 5 years ago

Please help me to get this stream, i got an unrecognized error ...here is m3u8 url

http://jiovod.cdn.jio.com/vod/_definst_/smil:vod/36/56/0_izp1jhtk_audio_1557210190048.smil/playlist_HD_PHONE_MDP_H.m3u8?jct=0XSXyKFdn_VdMWwgHgZfyg&pxe=1559058823&st=YZ5SRfj3wW9Cc6a18NST9g