English > Development

Script for egafd.com

<< < (21/27) > >>

pra15:
I changed procedure of search to more possibilities of results.
We can now obtain a result with "Segaud" for example.

I cleaned too variables who are not used.

I re-added conditions in parse people for <notes> <pseudonyms> and <Films> because i think within this, the script can give an error if for example :
there is part <notes> and there is not part <pseudonyms> in web page, in this case procedure parse page even so call parse people because 'IF pos(<notes>' is before 'IF pos(<pseudonyms' in parse page.

[attachment deleted by admin]

Ivek23:

--- Quote ---
--- Quote from: pra15 on December 24, 2011, 09:29:04 pm ---For ewample if you search Natacha, the script download info of Natacha but in the egafd (N) page there are other Natacha ( Natacha [2] , Natacha [3].....), so i would like that in the prlist i can choose the good natacha.
I you have an idea why the prlist not appears?

--- End quote ---

--- Quote from: pra15 on December 25, 2011, 03:17:49 pm --- http://www.egafd.com/actresses/details.php/id/n00082

--- End quote ---

--- End quote ---

Otherwise work fine, now it is again a problem with this:
when I search results for Natacha PVD freezes me with your latest script, while the previous version with no problems.
This version of search results should be kept and modify it a little further and really the right solution for search results.

pra15:
It was hard, but i found the errors.
I hope search works now.


--- Code: ---procedure SearchResults(HTML : string);

///////////////////////////////////////////////////////////////////////////////////////////
var curpos,endpos, counter : Integer; //
    actPosStart, actPosEnd, actalposStart, actalposEnd, urlPosStart, urlposEnd : integer;//
    beforeName, URLTemp, AliasName, NameTemp, RealName, ifAlias : string; //
///////////////////////////////////////////////////////////////////////////////////////////

Begin

//Search Name or Pseudo or part of name (with start in same alphabetic page as RealName)
Curpos := Pos(nomAct, HTML);

If curpos > 0 then begin

endPos := curpos;

While (curpos > 0) AND (curpos < PosFrom('<h2 class="index">Actress:', HTML, Endpos)) do begin
endpos := curpos;
actPosStart:= PrevPos('>', HTML, curpos);
actPosEnd := Posfrom('</', HTML, actposStart);
NameTemp := Trim(Copy(HTML, actPosStart+1, (actPosEnd-actPosStart-1)));
beforeName := Trim(Copy(HTML, actposStart-3, 1));

   If copy(NameTemp,1,9) = 'alias for' then
     ifAlias := 'True'
   else
   ifAlias := '';


  Case NameTemp of
    nomAct :  Begin                     //Same name as Title
    //logmessage('Same Name as title');
            Case BeforeName of
              'c' : Begin             //Real Name
              RealName := NameTemp;
              AliasName := NameTemp;
              // Get URL
              urlPosStart := Prevpos('href="', HTML, actposStart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        LogMessage('TYPE I');
              end;
             
            else begin              // Good Name but Alias
            //logmessage('Good Name but Alias');
              AliasName := NomAct;
              // Real Name
              actalPosStart := Posfrom('alias for ', HTML, actposEnd);
        actalposEnd := Posfrom('</span>', HTML, actalposstart);
        RealName := Trim(Copy(HTML, (actalposStart + 10), (actalposEnd - actalposStart - 10)));
        // Name Temp
        NameTemp := 'Alias for ' + RealName;
        // Get URL
        urlPosStart := PrevPos('href="', HTML, actPosstart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        LogMessage('TYPE II');
              end;
            end;
    end;
    else begin
      //Alias Name
          If ifAlias <> 'True' then begin
            If Copy(HTML, actPosStart-1,1) <> '>' then actPosStart := PrevPos('>', HTML, curpos);
      actPosEnd := Posfrom('</', HTML, actposStart);
      AliasName := Trim(Copy(HTML, actPosStart+1, (actPosEnd-actPosStart-1)));
      beforeName := Trim(Copy(HTML, actposStart-3, 1));
   
        Case beforename of
          'c' : Begin                   // Alias is real Name
              // Real Name
              RealName := AliasName;
              // Get URL
              urlPosStart := Prevpos('href="', HTML, actposStart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, RealName, '', LowerCase(URLTemp),'');
        logmessage('TYPE III');
          end;
       
        else begin
              // Real Name
              actalPosStart := Posfrom('alias for ', HTML, actPosEnd);
        actalPosEnd := Posfrom('</span>', HTML, actalPosStart);
        RealName := Trim(Copy(HTML, (actalposStart + 10), (actalposEnd - actalposStart - 10)));
        NameTemp := 'alias for ' + Realname;
        // Get URL
        urlPosStart := PrevPos('href="', HTML, actPosstart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        Logmessage('TYPE IV');
          end;
        end;
          end 
      else begin                  // Name is in Alias for ......
      logmessage ('trouve dans alias');
              // Alias Name
              actPosStart := Prevpos('"acta">', HTML, curpos);
              actPosEnd := Posfrom('</a>', HTML, actPosStart);
              Aliasname := Trim(Copy(HTML, (actPosStart + 7), (actPosEnd - actPosStart - 7)));
              // Real Name
              actalPosStart := Posfrom('alias for ', HTML, actposEnd);
        actalPosEnd := Posfrom('</span>', HTML, actalposStart);
              RealName := Trim(Copy(HTML, (actalposStart + 10), (actalposEnd - actalposStart - 10)));
              // Get URL
        urlPosStart := PrevPos('href="', HTML, actalPosstart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        actPosEnd := PosFrom('href="', HTML, actalPosEnd);
        logmessage('TYPE V');
end;
    end;
  end;
curpos := PosFrom(nomAct, HTML, actPosEnd);
end;
  end;
end;
--- End code ---

Ivek23:

--- Quote from: pra15 on December 26, 2011, 03:26:49 pm ---It was hard, but i found the errors.
I hope search works now.


--- Code: ---procedure SearchResults(HTML : string);

///////////////////////////////////////////////////////////////////////////////////////////
var curpos,endpos, counter : Integer; //
    actPosStart, actPosEnd, actalposStart, actalposEnd, urlPosStart, urlposEnd : integer;//
    beforeName, URLTemp, AliasName, NameTemp, RealName, ifAlias : string; //
///////////////////////////////////////////////////////////////////////////////////////////

Begin

//Search Name or Pseudo or part of name (with start in same alphabetic page as RealName)
Curpos := Pos(nomAct, HTML);

If curpos > 0 then begin

endPos := curpos;

While (curpos > 0) AND (curpos < PosFrom('<h2 class="index">Actress:', HTML, Endpos)) do begin
endpos := curpos;
actPosStart:= PrevPos('>', HTML, curpos);
actPosEnd := Posfrom('</', HTML, actposStart);
NameTemp := Trim(Copy(HTML, actPosStart+1, (actPosEnd-actPosStart-1)));
beforeName := Trim(Copy(HTML, actposStart-3, 1));

   If copy(NameTemp,1,9) = 'alias for' then
     ifAlias := 'True'
   else
   ifAlias := '';


  Case NameTemp of
    nomAct :  Begin                     //Same name as Title
    //logmessage('Same Name as title');
            Case BeforeName of
              'c' : Begin             //Real Name
              RealName := NameTemp;
              AliasName := NameTemp;
              // Get URL
              urlPosStart := Prevpos('href="', HTML, actposStart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        LogMessage('TYPE I');
              end;
             
            else begin              // Good Name but Alias
            //logmessage('Good Name but Alias');
              AliasName := NomAct;
              // Real Name
              actalPosStart := Posfrom('alias for ', HTML, actposEnd);
        actalposEnd := Posfrom('</span>', HTML, actalposstart);
        RealName := Trim(Copy(HTML, (actalposStart + 10), (actalposEnd - actalposStart - 10)));
        // Name Temp
        NameTemp := 'Alias for ' + RealName;
        // Get URL
        urlPosStart := PrevPos('href="', HTML, actPosstart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        LogMessage('TYPE II');
              end;
            end;
    end;
    else begin
      //Alias Name
          If ifAlias <> 'True' then begin
            If Copy(HTML, actPosStart-1,1) <> '>' then actPosStart := PrevPos('>', HTML, curpos);
      actPosEnd := Posfrom('</', HTML, actposStart);
      AliasName := Trim(Copy(HTML, actPosStart+1, (actPosEnd-actPosStart-1)));
      beforeName := Trim(Copy(HTML, actposStart-3, 1));
   
        Case beforename of
          'c' : Begin                   // Alias is real Name
              // Real Name
              RealName := AliasName;
              // Get URL
              urlPosStart := Prevpos('href="', HTML, actposStart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, RealName, '', LowerCase(URLTemp),'');
        logmessage('TYPE III');
          end;
       
        else begin
              // Real Name
              actalPosStart := Posfrom('alias for ', HTML, actPosEnd);
        actalPosEnd := Posfrom('</span>', HTML, actalPosStart);
        RealName := Trim(Copy(HTML, (actalposStart + 10), (actalposEnd - actalposStart - 10)));
        NameTemp := 'alias for ' + Realname;
        // Get URL
        urlPosStart := PrevPos('href="', HTML, actPosstart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        Logmessage('TYPE IV');
          end;
        end;
          end 
      else begin                  // Name is in Alias for ......
      logmessage ('trouve dans alias');
              // Alias Name
              actPosStart := Prevpos('"acta">', HTML, curpos);
              actPosEnd := Posfrom('</a>', HTML, actPosStart);
              Aliasname := Trim(Copy(HTML, (actPosStart + 7), (actPosEnd - actPosStart - 7)));
              // Real Name
              actalPosStart := Posfrom('alias for ', HTML, actposEnd);
        actalPosEnd := Posfrom('</span>', HTML, actalposStart);
              RealName := Trim(Copy(HTML, (actalposStart + 10), (actalposEnd - actalposStart - 10)));
              // Get URL
        urlPosStart := PrevPos('href="', HTML, actalPosstart);
        urlPosend := PosFrom('" class="', HTML, urlPosstart);
        URLTemp := BASE_URL + Trim(Copy(HTML, urlposStart + 6, (urlPosEnd-urlPosStart-6)));
        AddSearchResult(AliasName, NameTemp, '', LowerCase(URLTemp),'');
        actPosEnd := PosFrom('href="', HTML, actalPosEnd);
        logmessage('TYPE V');
end;
    end;
  end;
curpos := PosFrom(nomAct, HTML, actPosEnd);
end;
  end;
end;
--- End code ---

--- End quote ---

For Natacha I tried this and now it works.
Thank you.
Probably tomorrow, followed by some corrections and additions to the script.

Ivek23:
Here is a promise:

Added:

* I fixed a small bug in the Born.
* Added correction Birthday for better search years.
* Added correction DeathDate for better search years.
* Added link to Web Sites.
* Added link to the Internet Clubs and Groups.
* Both together for data transfer in Comment (Komentarji) field.Pictures attached.
* Corrected the following in Bio (part of this added code below).
--- Code: ---//if (Lien <> '') AND (Born = '') then
//AddFieldValue(pfBio, Lien);
//if (Lien  <> '') AND (Born <> '') then
//AddFieldValue(pfBio, Born + #13#10 + Lien);
if (Lien <> '') AND (Born2 = '') then
AddFieldValue(pfBio, Lien);
if (Lien  <> '') AND (Born2 <> '') then
AddFieldValue(pfBio, Born2 + #13#10 + Lien);
end;
--- End code ---

Deleted:

* In TabCountry removed Chinese and Greek due to incorrect data
The reason why I do the following:
An example of Chinese:
Chinese tattoo ---> incorrect Chinese the Birthplace
An example of Greek:
Green ---> incorrect in Greek the Birthplace
Proper two should not be recorded the Birthplace.

egafd_people (4)(Ivek23)14 script attached


[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version