snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.36k stars 440 forks source link

ERROR request failed with status code 403 #268

Closed frashersam closed 3 years ago

frashersam commented 3 years ago

Hello, i wanted to download videos using destreamer ( the links were in a txt archive) , and i went in a trouble, a got this message: I`m using windows 7, the comand was executed in "Node.Js comand pront"

2020-10-25 15_07_12-Greenshot

sorry for my bad english.

Verbose log ``` Your environment has been set up for using Node.js 12.19.0 (x64) and npm. C:\Users\sami\Desktop\1>destreamer -f 710.txt -o D:\1 -v [VERBOSE] Using ffmpeg version git-2020-05-01-39fb1e9 Copyright (c) 2000-2020 th e FFmpeg developers Access token still good for 57 minutes. [VERBOSE] Session and API info API Gateway URL: https://brso-1.api.microsoftstream.com/api/ API Gateway version: 1.4-private Parsing input file [WARNING] Line 39 is empty, skipping.. [VERBOSE] List of GUIDs and corresponding output directory https://web.microsoftstream.com/video/c8b7b3dd-e448-4a2c-b35d-5d2ffaac7a 9d => D:\1 https://web.microsoftstream.com/video/0a8f37ac-e31e-4585-9c85-6f88db82e5 56 => D:\1 https://web.microsoftstream.com/video/40040e8a-6316-4972-aa4a-8002d31dca a4 => D:\1 https://web.microsoftstream.com/video/48d62075-5d52-4761-9eb8-9f7fccd690 65 => D:\1 https://web.microsoftstream.com/video/68543bd0-ac95-49f3-aa61-8cce80591e 01 => D:\1 https://web.microsoftstream.com/video/b4181c35-3ef2-4b34-9150-4ce1c180b1 a7 => D:\1 https://web.microsoftstream.com/video/355adda7-a252-4ac0-b4af-97b44ae244 8b => D:\1 https://web.microsoftstream.com/video/25828bbd-6e37-4e57-a496-760c97a041 fe => D:\1 https://web.microsoftstream.com/video/6f0c17a8-378f-462e-b0dd-2fbcdc58ef 83 => D:\1 https://web.microsoftstream.com/video/a5b67c30-e0c3-472b-8693-6ebc54630e 42 => D:\1 https://web.microsoftstream.com/video/62e6b002-c9fa-4693-b04c-c5c494e1ff 5a => D:\1 https://web.microsoftstream.com/video/d669f1c0-7b7f-4458-b3f6-4f4d4ebed7 71 => D:\1 https://web.microsoftstream.com/video/ed958253-be2c-47ff-aff5-68d297d646 b5 => D:\1 https://web.microsoftstream.com/video/932e7b7d-1874-42f5-81af-e160249985 02 => D:\1 https://web.microsoftstream.com/video/4a2cc7e4-182c-449a-88a6-21aa497265 ff => D:\1 https://web.microsoftstream.com/video/72a3a1dd-7a3c-4910-934d-585352d67d 0e => D:\1 https://web.microsoftstream.com/video/6aa41d80-3ba8-4c87-9b68-6c2e534de4 ca => D:\1 https://web.microsoftstream.com/video/fd6765dd-edd7-4c54-8bf2-f4519d75f9 02 => D:\1 https://web.microsoftstream.com/video/98d7f2f8-9c9a-46b4-b7c4-5e918ecfb5 2b => D:\1 https://web.microsoftstream.com/video/97cfd123-adf2-406c-8017-55444315a2 79 => D:\1 https://web.microsoftstream.com/video/15e8aab2-385f-4860-8d83-e39d758780 19 => D:\1 https://web.microsoftstream.com/video/7602ed44-3677-42cc-be1b-ef15151c4c b7 => D:\1 https://web.microsoftstream.com/video/9ee807fb-7125-4064-bdc2-8e6850e689 89 => D:\1 https://web.microsoftstream.com/video/0f8e2a0a-2145-4167-a4c2-81085e508b 8c => D:\1 https://web.microsoftstream.com/video/540f4169-fae4-46f1-a764-a7bd2ef710 db => D:\1 https://web.microsoftstream.com/video/da73b014-645b-48d6-9deb-ced394cdc5 9f => D:\1 https://web.microsoftstream.com/video/ca6da40a-8a43-4c43-b2c1-a47b7087dc 8b => D:\1 https://web.microsoftstream.com/video/9499782d-e4ba-4678-b56c-3a6a8859e1 f3 => D:\1 https://web.microsoftstream.com/video/554f9033-f05f-4d53-ba5a-b23bbc5c76 92 => D:\1 https://web.microsoftstream.com/video/5d8ce038-f49f-4686-9fa8-f186c11813 96 => D:\1 https://web.microsoftstream.com/video/8c7e0445-3683-4e38-8774-77454c46b9 cf => D:\1 https://web.microsoftstream.com/video/1ff578dd-48a9-4066-877b-7beb9037b6 dd => D:\1 https://web.microsoftstream.com/video/c04a0b36-c0e8-4335-9102-5b07816ece d2 => D:\1 https://web.microsoftstream.com/video/70f07709-bb2f-4b8b-8f44-2c150fdaf9 9d => D:\1 https://web.microsoftstream.com/video/d8937444-6c75-4db6-aa07-bbc397c6b0 c8 => D:\1 https://web.microsoftstream.com/video/315bb4ae-d591-4c40-bb58-6a6467f2d8 95 => D:\1 https://web.microsoftstream.com/video/78932bcc-a55d-4c80-bb81-6cf3ab7243 c2 => D:\1 https://web.microsoftstream.com/video/191925fe-e6bd-477b-8d9c-d12dbf8664 61 => D:\1 Fetching videos info... [WARNING] Got HTTP code 403. Retrying request... [VERBOSE] Here is the error message: '[object Object] [ERROR] Error: Request failed with status code 403 at createError (C:\Users\sami\Desktop\1\node_modules\axios\lib\core\createEr ror.js:16:15) at settle (C:\Users\sami\Desktop\1\node_modules\axios\lib\core\settle.js:17: 12) at IncomingMessage.handleStreamEnd (C:\Users\sami\Desktop\1\node_modules\axi os\lib\adapters\http.js:236:11) at IncomingMessage.emit (events.js:326:22) at endReadableNT (_stream_readable.js:1223:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) C:\Users\sami\Desktop\1> ```

Please help me!

lukaarma commented 3 years ago

Can you normally play those video in a web browser? Because 403 normally means that you can't access them

frashersam commented 3 years ago

Hello, yes i'm able to play and acces to this videos on web broser ( also en microsoft team and microsoft steam), i noticed that I can download link by link from the txt archive, but web I run this comand: destreamer -f 710.txt -o D:\1 -v got the error... run fine: destreamer -i urlvideo -o D:\1 -v --skip

Thanks for you attention

roosteer commented 3 years ago

Hi, I have seen the same bug. The problem is in txt's number line.

cristianapas commented 3 years ago

Hello, I have seen the issue using -i, but I normally play video in browser.

sorry for my bad english.

cristianapas commented 3 years ago

Hi,

Could it be that it only works if you are the owner of the video? As an administrator I can see them, but the only way to download them is by setting my username as the owner.

wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf commented 3 years ago

hi there, first off, thanks for an awesome project that helped me "save Ms Stream videos for offline enjoyment". I have also recently encountered this issue (403 on download attempt). I do have the permissions to watch the subject content, though I am not the owner of it.

This error is relatively new to me, although I see this Issue dates back to Oct 25 2020. I have been destreaming videos as early as Nov 4 2020 (file timestamps) without issues using ./destreamer.sh -f path/to/textfile.txt --skip --username "uname@domain.tld" --vcodec libx265 -o destination, where "textfile.txt" contains a list of "Stream" urls, one per line. I even got excited and checked out the aria2c_forRealNow branch destreamer.sh for amazing speedups 🎉 .

Recently I added a couple of new urls and tried destreaming some moar..only to get this

~/utils/destreamer on  aria2c_forRealNow is 📦 v2.1.0 via ⬢ v12.19.0
➜  ./destreamer.sh -f path/to/textfile.txt --skip --username "uname@domain.tld" --vcodec libx265 -o destination
Username: uname@domain.tld
Access token still good for 40 minutes.

Parsing input file

[WARNING] Line 14 is empty, skipping..
...
empty line warnings...
...
[WARNING] Line 64 is empty, skipping..
Fetching videos info...

[WARNING] Got HTTP code 403. Retrying request...

[ERROR] Error: Request failed with status code 403
    at createError (/home/user/utils/destreamer/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/home/user/utils/destreamer/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/home/user/utils/destreamer/node_modules/axios/lib/adapters/http.js:236:11)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1223:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

I headed to projects issues page and found this issue. And I learnt that destreaming works fine when attempting it on a single url at a time. Which also worked for me 🎉 .

I just wanted to inform that the issue is still present. Anything I could do to help debug this?

snobu commented 3 years ago

Try running destreamer with -v for verbose. It should print out the URL and reason for the 403 Forbidden HTTP error.

wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf commented 3 years ago

sure, here.

Downloading video info, this might take a while...

[WARNING] Got HTTP code 403. Retrying request...

[VERBOSE] Here is the error message:
{"error":{"code":"Forbidden","message":"The authenticated user is not authorized to access this resource."}}
Retrying request...

[VERBOSE] We called this URL: https://euwe-1.api.microsoftstream.com/api/videos/37a8cbbb-3fb6-47f6-b0d7-12morechars?$expand=creator&api-version=1.4-private

[ERROR] Error: Request failed with status code 403
    at createError (/home/user/utils/destreamer/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/home/user/utils/destreamer/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/home/user/utils/destreamer/node_modules/axios/lib/adapters/http.js:260:11)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1223:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

[FATAL ERROR] Unhandled error or uncaught exception!

aaand I got it now - it was my bad. Some videos have apparently changed permissions (since added to the list) and I don't have the right to view them anymore. Verbose printing you suggested helped (silly me) - showed me the url that returned 403 --> I put it in the browser and got this image

After removing the 403-returning urls (there were actually two of them) from the list, destreamer works great again. It'd be great to have it handle 403s gracefully, perhaps.

edit: what confused me was that I got 403 after I added some urls to destream, which coincidentally collided with the fact that in the meanwhile I have had permissions revoked on another videos... in any case, always do verbose - tells a lot :D

snobu commented 3 years ago

Yes, we should print the response body for a 403 even when running without -v. I remember i was about to do that but got distracted.. or i did implement it but didn't push to remote... or was it all just a dream. Who knows anymore.

Thanks for your confirmation.