rebane2001 / matterport-dl

A downloader for matterport virtual tours
The Unlicense
291 stars 73 forks source link

Error 401: Unauthorized File #64

Open charliejameslockwood opened 2 years ago

charliejameslockwood commented 2 years ago

Hi,

I've been applying various fixes in the unmerged PRs to try and archive a model I'm interested in.

It seems to archive, but then when I try to host the files locally using the built in server, I get the "Oops, model is not available" message.

When checking the run_report log and the console in my browser, I see a lot of Errors.

In the run_report log the messages all start HTTP Error 401: Unauthorized file...

In the server log I see one warning 404 error: api/v1/jsonstore/model/trims/{my-id} may not be downloading everything right

In the console the errors are more varied but include:

Any ideas?

patricknelson commented 2 years ago

Hmm... I'm having a similar UI error message, however, ho such HTTP requests seem to be emitted (nor received by the server, according to the logs). If you format the source code and check that line, it appears to be reverting to requiring authentication in the JavaScript and they (for some reason, maybe lack of experience or potentially to "throw off the scent") they output "Access denied (403)", even though no actual HTTP request was issued (given 403 is an actual "Forbidden" error code).

2022-07-08_11-56-21

patricknelson commented 2 years ago

Digging a bit deeper I've made some progress and boiled it down to the fact that the script now needs support for a few more graph queries:

I copied the contents of those requests, then stubbed those out in the root ./graph_posts/ directory, swapped out the [MATTERPORT_MODEL_ID] placeholder and then re-ran the download and... viola! It's working. I'll consider issuing a PR, but for now, check out this commit here: https://github.com/rebane2001/matterport-dl/commit/2045df553ca0b94028855ba4185d20c8316190d7

The only issue I'm seeing now is that it's still issuing CDN requests to matterport.com when it should be referencing locally cached data, but at least I got past that initial hurdle. I'll need to spend more time over the weekend to figure the rest of that CDN stuff out, though.

patricknelson commented 2 years ago

Ok, figured out download of additional assets (trims) and also better isolation of resources, ensuring it points to the local server instead of the CDN. Code wise, the last remaining piece is to refactor references to things like cdn-2.matterport.com in the cached graph JSON responses (i.e. under ./[MATTERPORT_MODEL_ID]/api/mp/models/graph/graph_*).

You can see my hacky WIP here: #65