(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=h0ttz ( h0ttzspam@gmail.com ), previous versions by Guardião and mikepax Title=InterFilmes Description=Movie importation script for InterFilmes.com Site=http://www.interfilmes.com Language=BR Version=2.00 Requires=3.5.1 Comments=Script feito por h0ttz para o site "http://www.interfilmes.com"|Caso detectem erros, me mande um email: h0ttzspam@gmail.com| License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | GetInfo=1 [Options] ***************************************************) program InterFilmes; var MovieName:string; //Iniciado em 08-06-2010 uses StringUtils1; // Método Para Trazer Dados do Filme procedure AnalyzeFilmPage(Address:string); var Page:TStringList; valor, valor2:String; i:integer; begin Page := TStringList.Create; valor:='http://www.interfilmes.com/'+Address; valor := StringReplace(valor, 'filme_', 'filme_v1_'); valor := TextBefore(valor, '-(', ''); Page.Text:=GetPage(valor+'.html#Elenco'); // Seta URL HTMLDecode(valor); SetField(fieldURL,valor); // Seta Descrição valor:=TextBetween(Page.Text,''); HTMLRemoveTags(valor); HTMLDecode(valor); SetField(fieldDescription, trim(valor)); // Seta Título Original i:=FindLine('Título Original:',Page,0); valor:=Page.GetString(i+1); i:=Pos('
',valor); valor:=Copy(valor,1,i-1); HTMLDecode(valor); SetField(fieldOriginalTitle, trim(valor)); //Seta Título no Brasil i:=FindLine('Título no Brasil:',Page,0); valor:=Page.GetString(i+1); i:=Pos('
',valor); valor:=Copy(valor,1,i-1); HTMLDecode(valor); SetField(fieldTranslatedTitle, trim(valor)); // Seta Produtora i:=FindLine('Estúdio/Distrib.:',Page,0); valor:=Page.GetString(i+1); i:=Pos('
',valor); valor:=Copy(valor,1,i-1); HTMLDecode(valor); SetField(fieldProducer, trim(valor)); // Seta Gênero i:=FindLine('Gênero:',Page,0); valor:=Page.GetString(i+1); i:=Pos('
',valor); valor:=Copy(valor,1,i-1); HTMLDecode(valor); SetField(fieldCategory, trim(valor)); // Seta Ano de Lançamento i:=FindLine('Ano de Lançamento:',Page,0); valor:=Page.GetString(i+1); i:=Pos('
',valor); valor:=Copy(valor,1,i-1); HTMLDecode(valor); SetField(fieldYear, trim(valor)); // Seta Duração valor:=TextBetween(Page.Text,'Tempo de Duração: ',' '); HTMLDecode(valor); SetField(fieldLength, trim(valor)); // Seta Direção i:=FindLine('Direção:',Page,0); valor:=TextBetween(Page.Text,'.html>','
'); HTMLRemoveTags(valor); HTMLDecode(valor); SetField(fieldDirector, trim(valor)); // Seta País de Origem i:=FindLine('País de Origem:',Page,0); valor:=Page.GetString(i+1); i:=Pos('
',valor); valor:=Copy(valor,1,i-1); HTMLDecode(valor); SetField(fieldCountry, trim(valor)); // Seta Elenco valor2:='Elenco
'; i:=FindLine(valor2,Page,0); valor:=Page.GetString(i); valor:=StringReplace(valor,valor2,''); valor:=StringReplace(valor,'
',#13#10); HTMLRemoveTags(valor); HTMLDecode(valor); SetField(fieldActors, trim(valor)); // Seta Imagem do Filme i:=FindLine('',Page,0); valor:=Page.GetString(i+1); valor:='http://www.interfilmes.com/'+TextBetween(valor,'src="','"'); GetPicture(valor); // Seta Nota/Avaliação valor:=Page.Text; valor2:=''; i:=0; repeat i:=Pos('estrela.gif',valor); if i>0 then begin Delete(valor, 1, i + 1); valor2:=IntToStr(StrToInt(valor2,0)+1); end; until i=0; valor2:=IntToStr(StrToInt(valor2,0)*2); SetField(fieldRating,valor2); Page.free; end; // Método para Trazer Todos os Comentários procedure AnalyzeFilmPageComments(Address:string); var Page:TStringList; valor:String; begin Page := TStringList.Create; valor:='http://www.interfilmes.com/'+Address; valor := StringReplace(valor, 'filme_', 'filme_c'); valor := TextBefore(valor, '-(', ''); Page.Text:=GetPage(valor+'.html#Comentario'); // Seta Comentários valor:=TextBetween(Page.Text,'

','

','['); valor:=StringReplace(valor,'',']'); valor:=StringReplace(valor,']',' '); valor:=StringReplace(valor,#13#10'[','['); valor:=StringReplace(valor,']'#13#10,']'); valor:=StringReplace(valor,'
',#13#10); valor:=StringReplace(valor,' ',' '); valor:=StringReplace(valor,'',#13#10); valor:=StringReplace(valor,'[',#13#10'['); HTMLRemoveTags(valor); valor:=StringReplace(valor,'Nota: ',' '); HTMLDecode(valor); SetField(fieldComments, trim(valor)); Page.free; end; procedure AnalyzePage(Address: String); var Page:TStringList; i:integer; nome, url:string; begin PickTreeClear; Page := TStringList.Create; Page.Text := PostPage(Address,'search='+MovieName); i:=0; repeat i:=FindLine('',Page,i+1); nome:=Page.GetString(i); HTMLRemoveTags(nome); if (length(nome)>0) then begin url:=Page.GetString(i-1); url:=TextBetween(url,'"','"'); PickTreeAdd(nome,url); end; until i=-1; if PickTreeExec(Address) then AnalyzeFilmPage(Address); AnalyzeFilmPageComments(Address); Page.free; end; begin PickListClear; MovieName := GetField(fieldOriginalTitle); if Input('Importar do InterFilmes.com', 'Escreva o nome do filme:', MovieName) then begin MovieName := StringReplace(MovieName, ' ', '+'); AnalyzePage('http://www.interfilmes.com/busca.html'); end; end.