IMDB Ratings Importer

Import ratings for movies, TV series and episodes from a csv file.

< Feedback on IMDB Ratings Importer

Review: Good - script works

§
Posted: 2023-05-17
Edited: 2023-05-17

Fields 'const' and 'your ratings" are required. Alternative spelling 'Const' and 'Your Ratings' are also accepted.

It is "your rating" (case insensitive), else it won't work.

Also, if the file has Windows line endings, then fieldNames === ['const', 'your rating\r'] which fails validation. The line endings have to be Unix.

And then it runs... each request failing:

{"errors":[{"message":"FORBIDDEN exception code while fetching data (/rateTitle) : Authentication required for mutation.","path":["rateTitle"],"extensions":{"errorType":"CLIENT","isRetryable":false,"path":["rateTitle"],"code":"FORBIDDEN"}}],"data":null,"extensions":{"disclaimer":"Public, commercial, and/or non-private use of the IMDb data provided by this API is not allowed. For limited non-commercial use of IMDb data and the associated requirements see https://help.imdb.com/article/imdb/general-information/can-i-use-imdb-data-in-my-software/G5JTRESSHJBBHTGX#"}}

Since the following headers are missing:

x-amzn-sessionid
x-imdb-client-name
x-imdb-client-rid
x-imdb-user-country
x-imdb-user-language
x-imdb-weblab-treatment-overrides

Nothing is imported. Windows, Chrome, Violentmonkey.

Neinei0kAuthor
§
Posted: 2023-05-17

Thanks for bug report.

I actually also mixed up 'your ratings' and 'your rating' in the code, but caught it myself when testing csv file exported from IMDB. Apparently I forgot to change it in the description.

The problem with line endings is fixed. But for clarification, line endings didn't have to be Unix (even so I kind of mistakenly assumed that they are). If 'your rating' is not the last field in the file, which is true if csv file was exported from IMDB, then it would have worked.

I'm still working on the last problem. I reproduced it by using Violentmonkey with Firefox.

§
Posted: 2023-05-17

Nice!

I haven't looked too close, but it seems the entire IMDb cookie fails to parse on my setup. I take it it works in e.g. Greasemonkey?

Neinei0kAuthor
§
Posted: 2023-05-17

I'm not sure where those headers came from, but the problem was with the same-origin policy. Request to set rating is send to a different domain name. Because of this Violentmonkey didn't add cookies with the request. The script used JavaScript XMLHttpRequest for this. But GM.xmlHttpRequest allows requests to cross the same origin policy boundaries. By using it instead, the problem should be fixed. I tested with Greasemonkey and Violentmonkey. All worked.

§
Posted: 2023-05-17
Edited: 2023-05-17

Tested 1.2, works on Tampermonkey and Violentmonkey. Great job. I was beginning to wonder if maybe violence isn't the solution...

Post reply

Sign in to post a reply.