Ok, I got it!
One (right) bracket missing, and one sufficient "end". This was what I asked for
procedure ParseMovie(MovieURL : String; HTML : String);
var
curPos, endPos : Integer;
Date, Title, URL, Month, Month1, Months, TmpStr, TmpStr0, TmpStr1,
TmpStr2 : String;
DateParts : TWideArray;
begin
//Date ~Updated~ (choose simple or verbose version)
Date := DateToStr(CurrentDateTime);
if Date <> '' then
begin
ExplodeString(Date, DateParts, '-');
Date := DateParts[2] +'.'+ DateParts[1] +'.'+ DateParts[0];
AddCustomFieldValueByName('RTUpdated', Date + ' at ' + TimeToStr
(CurrentDateTime) + ' • ' + RATING_NAME + ' ' + SCRIPT_VERSION); //
Annoying
end else
LogMessage('date not found');
//Get ~mfURL~ or ~RT Url~
endPos := Pos('" rel="canonical" itemprop="url"/>', HTML);
if endPos > 0 then begin
curPos := PrevPos('</title> <link href="', HTML, endPos);
AddFieldValue(mfURL, Copy(HTML, curPos + 21, endPos - curPos - 21));
end else
AddFieldValue(mfURL, MovieURL);
AddCustomFieldValueByName('Rottentomatoes.com', '<link url="' + MovieURL +
'">Rottentomatoes.com</link>');
////// ---- ~Movie~ ---- //////
//~Title~
curPos := Pos('" itemprop="name"> ', HTML) + Length('" itemprop="name"> ');
EndPos := PosFrom('</span></h1>', HTML, curPos);
TmpStr := RemoveTags(Trim(Copy(HTML, curPos, endPos - curPos)), false);
TmpStr := StringReplace(TmpStr, ' ', ' ', True, True, False);
if TmpStr <> '' then
AddCustomFieldValueByName('Title',TmpStr);
Once again, thanks a lot, Ivek!