Perg0 Posted January 2, 2021 Share Posted January 2, 2021 Bois... i think i finaly got in over my head big time. I'm working on a script that will work like a interactive cleverbot (because that seams like a good idear after 2020 >.<) I'm trying to make a script that can read the <p>Content</p> tags on my website- Tho i don't seam to be able to limit it. Here is the code and sorry for bad english in advance. key http_request_id; default { state_entry() { http_request_id = llHTTPRequest("https://purge-0.000webhostapp.com/SL.html", [], ""); } http_response(key request_id, integer status, list metadata, string body) { if (request_id != http_request_id) return; // exit if unknown vector COLOR_GREEN = <0.0, 1.0, 0.0>; float OPAQUE = 1.0; llSetText(body, COLOR_GREEN, OPAQUE); } } Thanks in advance for the help! this forum is the best! Link to the web ofc: https://purge-0.000webhostapp.com/SL.html ~Perg0 Link to comment Share on other sites More sharing options...
Perg0 Posted January 2, 2021 Author Share Posted January 2, 2021 i should mention by "limit" i mean that the script litteraly reads the entire HTML code like: !DOCTYPE html <head> <Title> SL </title> </head> <Body..... Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted January 2, 2021 Share Posted January 2, 2021 I don't think there's any way to pick which part of the page you're getting, all you can do is parse it down after you've received the page. So llSubStringIndex and llGetSubString. You should include some unique strings onto your page so you can reliably search for them in the response. Alternatively you should create the page itself in such a way that it has no other content besides the text you need. No tags, nothing. 2 Link to comment Share on other sites More sharing options...
Perg0 Posted January 2, 2021 Author Share Posted January 2, 2021 Thanks- i will experiment with it and see what i can get to work. Link to comment Share on other sites More sharing options...
animats Posted January 2, 2021 Share Posted January 2, 2021 LSL has a parser for JSON. If you can make your site emit JSON, that's easier to deal with than trying to parse HTML yourself in LSL. What you're trying to do is quite possible, but more work than necessary. LSL also has something for parsing comma-separated values. Web pages don't have to be HTML. They can be text/text or text/json, as well as text/html. There are lots of resources available about making web sites do what you want. In general, it's better to make a web site that talks easily to LSL than making LSL to talk to an existing web site. LSL has severe memory and compute limitations, and the language is not well suited to parsing. Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted January 3, 2021 Share Posted January 3, 2021 Reminds me, I've tried using the Range header with HTTP_CUSTOM_HEADER but it doesn't seem to work right when using a starting range other than 0, like Range,bytes=500-999 Web pages that return 206 with a starting value of 0 return a status of 499 when greater than 0 is used. Other web pages return a status of 200, but the data is from the start of the page. Anyone successfully use it before? Link to comment Share on other sites More sharing options...
Perg0 Posted January 4, 2021 Author Share Posted January 4, 2021 NGL when the first thing you read from the wiki is: //all these functions are untested functions that may have some very strange cases were they acd badly or where the comments are wrong //see them as buggy PSEUDO-code and consider yourself lucky if there are less than 2 wrong counters and 4 bad pointers/names. //they are more an example and a concept and unlikely fully functional AS IS. You get sketchy XD. Tho it looks to have promising offers- i re-downloaded my python 3 aswell as configured a Google-Sheets doc for it. Ontop LSL seams to read the website just fine if i don't post "code" on it. All in all it looks like 2021 might be a better year, since already now stuff is working better! ^^ Thanks for the help again! imma keep looking into this. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now