English > Scripts and Templates

Project Allocine script

(1/11) > >>

pra15:
Hello,
I would like to make a script for allocine.fr.
I thought make two script because info are in different page.
The first script give the link of the movie and when we have it, use this link in a second scipt to take info from actors or image.
I started to make the first script (attached).

In Allocine.fr the page of result to a search of movie give several results, but it seems i can't obtain more than one result in my prList.
In The Code of the page we can see all the movies but it seems they are hide for the script exept the first.
I know nothing about HTML programming. If someone can explain That!


--- Quote ---</span> <!-- /fs11 -->
</div></div></td></tr>
--- End quote ---

Probably it's after this (in red in the code page).

I stop the code because in the page of casting it's the same principle and if we can't resolve this..........

N.B: I tried different boucles.... Erase in the script because don't work.
I tried to Pos('Second movie') give 0.


This script has now been released and is available via the program's auto-update system. Run Help > Check for updates and choose Allocine.fr from the list.

Ivek23:
Try this code
--- Code: ---procedure ParseSearchResults(HTML: string);
Var
CurPos, EndPos, EndSearch, nbResult, PosEssai1, PosEssai2 : Integer;
Year, MovieURL, ThumbURL, Title : String;

Begin
NbResult := 0;
CurPos := Pos('Films</h2>',HTML);
If CurPos < 1 then
Exit;

//Addresse Thumbnail :
CurPos := PosFrom('src=',HTML,CurPos)+5;
EndPos := PosFrom('.jpg',HTML,CurPos)+4;
ThumbURL := Trim(Copy(HTML,CurPos,EndPos-CurPos));
//Addresse page Film :
//CurPos := PosFrom('<a href=',HTML,EndPos);
CurPos := PosFrom('<a href=',HTML,CurPos);
//while curPos > 0 do begin
while (curPos > 0) AND (curPos < PosFrom('<button class="buttonform" type="submit">Rechercher</button>', HTML, endPos)) do begin
EndPos := PosFrom('.html',HTML,CurPos);
MovieURL := BASE_URL + Trim(Copy(HTML,CurPos+9,EndPos-CurPos-4));
//Nom Film :
CurPos := PosFrom('>',HTML,EndPos)+1;
EndPos := PosFrom('<br />',HTML,CurPos);
Title := Copy(HTML,CurPos,EndPos-CurPos);
Title := StringReplace(Title,'<b>','',True,True,True);
Title := StringReplace(Title,'</b>','',True,True,True);
Title := StringReplace(Title,'</a>',' (fr) / ',True,True,True);
LogMessage('Titre Recherche: ' + Title);
//Année :
CurPos := PosFrom('<span class="fs11">',HTML,EndPos);
if Curpos > 0 then begin
//Curpos := Curpos + 19;
//EndPos := PosFrom('<br />',HTML,CurPos);
//Year := Copy(HTML,CurPos,EndPos-CurPos);
Year := TextBetween(HTML, '<span class="fs11">', '<br />', True, CurPos);
LogMessage('Annee: ' + Year);
end else begin
Year := '';
curPos := endPos;
end;
//Ajout du film dans la liste des résultats :
AddSearchResult(Title,'', Year, MovieURL, ThumbURL);

//Addresse Thumbnail :
CurPos := PosFrom('src=',HTML,CurPos)+5;
EndPos := PosFrom('.jpg',HTML,CurPos)+4;
ThumbURL := Trim(Copy(HTML,CurPos,EndPos-CurPos));

CurPos := PosFrom('<a href=',HTML,CurPos);
end;

End;
--- End code ---
it should work, at least for me it worked.

pra15:
No, i'm just tryingit but i have just one movie in my windows result prlistImage while in the site there are several movies.
I try with word "anneaux".

Ivek23:

--- Quote from: pra15 on February 08, 2015, 10:37:44 pm ---No, i'm just tryingit but i have just one movie in my windows result prlistImage while in the site there are several movies.
I try with word "anneaux".
--- End quote ---

With word "anneaux" for me work is OK. See the attached image.

pra15:
Thanks, yes it works.
After several trying i've forgotten erase manually original title, sorry.

Navigation

[0] Message Index

[#] Next page

Go to full version