English > Support

New FilmAffinity Script

<< < (3/3)

afrocuban:
Here's updated code for "Description" field:


--- Code: ---       // Get ~description~ from the HTML.
curPos := Pos('<dt>Synopsis</dt>', HTML);
if curPos > 0 then // Ensure the synopsis section is found
begin
    curPos := PosFrom('<dd class="" itemprop="description">', HTML, curPos); // Locate the synopsis description div
    curPos := curPos + Length('<dd class="" itemprop="description">'); // Adjust curPos to the end of the opening tag
    endPos := PosFrom('</dd>', HTML, curPos); // Locate the closing tag


    // Extract the relevant section of the HTML
    ItemValue := Copy(HTML, curPos, endPos - curPos);
    LogMessage('Parse results description: ' + ItemValue + '||');


    // Clean up and format the ItemValue
    ItemValue := Trim(StringReplace(ItemValue, '(FILMAFFINITY)', '', True, True, False)); // Remove specific tags or text
    ItemValue := RemoveTags(ItemValue, False);
    LogMessage('Cleaned description: ' + ItemValue + '||');


    // Add the cleaned description to the XML field
    AddFieldValueXML('description', ItemValue);
    LogMessage('Get result description: ' + ItemValue + '||');
end // Properly terminate the if block
else
begin
    LogMessage('Synopsis section not found.');end;
--- End code ---

afrocuban:

--- Quote from: afrocuban on December 02, 2024, 11:11:12 pm ---Does anyone have an idea why this script wouldn't populate data, although it parses them (poster)?

--- End quote ---

Unfortunately, FilmAffinity doesn't provide http links to pics any more:


--- Quote ---C:\Users\user>curl -I http://pics.filmaffinity.com/bookworm-371036333-large.jpg
HTTP/1.1 301 Moved Permanently
Date: Wed, 04 Dec 2024 20:11:52 GMT
Content-Type: text/html
Content-Length: 167
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Wed, 04 Dec 2024 21:11:52 GMT
Location: https://pics.filmaffinity.com/bookworm-371036333-large.jpg
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=Mjz%2B8pecaYxQxzpSkhAuFdftbG6ya0xXg%2BrjQQWzjZQmTEKL%2FGvFTGYbXU9HCka1CJMZPDOLkmSrCuhdqDJ%2BXbeorrMFwgP6FrKFpZZovX8btXvLWdYfrK6jjdS6zssZ4f3snbIHGA%3D%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 8ece72b65de05b67-VIE
server-timing: cfL4;desc="?proto=TCP&rtt=10158&min_rtt=10158&rtt_var=5079&sent=1&recv=3&lost=0&retrans=0&sent_bytes=0&recv_bytes=114&delivery_rate=0&cwnd=249&unsent_bytes=0&cid=0000000000000000&ts=0&x=0"
--- End quote ---


Here's updated snippet that provides poster only via Proxomitron:

--- Code: ---


//Get ~poster~
    ItemValue:=TextBetWeen(HTML,'<a class="lightbox" style="display: block;" href="','"',false,curPos);            //Strings which opens/closes the data.'https://pics.filmaffinity...-large.jpg. WEB_SPECIFIC
     //Unfortunately the http links for the pics are not available anymore. This snippet only via Proxomitron-like proxies
    AddImageURL(itPoster,ItemValue);
    LogMessage('      Get result poster:'+ItemValue+'||');
--- End code ---

afrocuban:
Using AI (will not address that in the future since it will be implied by default), I have done major rewrite and changes to FilmAffinity script. I will try to maintain and upgrade it in the future, at least for myself and will offer it to others here. Here are the changes since VVV last changed it in 2020.



--- Quote ---CHANGE LOG :
           V 5.0.0.1-afrocuban (12/05/2024) afrocuban: Poster now available via HTTPS
           V 4.2.0.0-afrocuban (12/01/2024) afrocuban: Updated Actors and Description are now again available for import. Poster now available only via Proxomitron
--- End quote ---

Navigation

[0] Message Index

[*] Previous page

Go to full version