Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
old script stopped working
This thread has 4 replies. Displaying all posts.
Post 1 made on Friday February 18, 2022 at 18:39
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
Been using this script for KODI for a while, worked great for retrieving the cover art for movies. Checked to make sure KODI did not change some thing, it did not. Have varied that the script is parsing out the correct data for "CoverMovie1 and 2", this script worked great until the other day, if I use manually assign data into the variables, just to make sure its not a parsing issue, still no go.

var coverMovie1 = "9767";
var coverMovie2 = "the-break-up-57f3a9b480b06";

No IOError being displayed


function kodi4(){
var socket = new TCPSocket();
var receivedData = "";
var coverMovie2 = "the-break-up-57f3a9b480b06";
socket.onConnect = function() {
socket.write("GET /thumb.php?src=/fanart/movies/"+coverMovie1+"/movieposter/"+coverMovie2+".jpg&a=t&h=210&w=139 HTTP/1.0\r\n");
socket.write("HOST:assets.fanart.tv\r\n");
socket.write("CONNECTION: close\r\n");
socket.write("\r\n");
};
socket.onData = function() {
receivedData += socket.read();
};
socket.onIOError = function (e) {
GUI.widget("data").label = "IOError " + e;
};
socket.onClose = function () {
var imageStartIndex, bitmapData, myImage;
imageStartIndex = receivedData.indexOf("\r\n\r\n");
bitmapData = receivedData.substring(imageStartIndex+4);
myImage = new Image(bitmapData);
GUI.widget("MOVIE_COVER").setImage(myImage);
GUI.widget("MOVIE_COVER").stretchImage = true;
};
socket.connect("assets.fanart.tv",80, 500);
};

Last edited by mpg7321 on February 18, 2022 18:51.
Post 2 made on Saturday February 19, 2022 at 07:23
sebastian
Long Time Member
Joined:
Posts:
September 2003
93
If you assemble the URL the script is trying to fetch, you get:

http:// assets.fanart.tv /fanart/movies/9767/movieposter/the-break-up-57f3a9b480b06.jpg

Feeding this to e.g. curl shows that this results in a redirect to the https:// version of the URL:

$ curl -v http: // assets.fanart.tv /fanart/movies/9767/movieposter/the-break-up-57f3a9b480b06.jpg
*   Trying 159.69.64.140:80...
* Connected to assets.fanart.tv (159.69.64.140) port 80 (#0)
> GET /fanart/movies/9767/movieposter/the-break-up-57f3a9b480b06.jpg HTTP/1.1
> Host: assets.fanart.tv
> User-Agent: curl/7.77.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Server: nginx
< Date: Sat, 19 Feb 2022 12:16:56 GMT
< Content-Type: text/html
< Content-Length: 162
< Connection: keep-alive
< Location: https:// assets.fanart.tv /fanart/movies/9767/movieposter/the-break-up-57f3a9b480b06.jpg


I don't think the Pronto can do https, so that's probably the end of the line - Lyndel, please correct me if I'm wrong.

Sebastian

EDIT: added some spaces to the URL so the forum software does not fetch and display the content.
OP | Post 3 made on Saturday February 19, 2022 at 12:22
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
So that worked without issues until this last week, I am afraid they made some changes to the website. I do not remember for sure back when we wrote this but I believed it was HTTPS back then as well. I can't swear to it.
Post 4 made on Saturday February 19, 2022 at 12:25
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Pronto does not do HTTPS.

You can do what I did for Flickr and stand up some man in the middle node js code on Raspberry pi that you can point Pronto to with HTTP and have it then send your request on to the https site.

I'd be happy to share a zip of the project but am not prepared to offer detailed support on installing nodejs on a pi or other platform and extreme configurations.

My code runs at /home/pi/node/httpsGateway and supports installing a systemctl service to start from this directory.

Example url requested by client:
http[colon-slash-slash]:<localhost>:<port>/https_get?cache_secs=<time in seconds>&target_url=<encoded https url to retrieve>

Note that cookies are not supported here. As a client, you will receive most response headers but current code does not support forwarding request headers.

Last edited by Lyndel McGee on February 19, 2022 12:50.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 5 made on Saturday February 19, 2022 at 17:09
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
I just hit the URL above in Google Chrome and did not get the upgrade to https.
Here are the request headers from developer mode.

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
DNT: 1
Host: assets.fanart.tv
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36

Before going through many hurdles, you might consider trying to upgrade your ProntoScript to send this header but with a value of 0.

Also, if you want to try things out without using curl, I highly recommend PostMan as a test platform as you can 'tweak' the headers.
Lyndel McGee
Philips Pronto Addict/Beta Tester


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse