(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=bettertwo, Fulvio53s03 Title=IAFD Description=Get movie info from iafd.com Site=http://www.iafd.com Language=EN Version=3.01 - 22.04.2023 Requires=3.5.0 Comments=See code comments License=GPL GetInfo=1 RequiresMovies=1 [Options] [Parameters] ***************************************************) program IAFD; // riportare le options prima del program IAFD // [Options] // BatchMode=1|0|0=Search Info using title info|1=Use FieldUrl to extract info // AutoSelect=1|1|0=Always show movie selection dialog|1=Auto-select movie if there is only one// // AddOldDescription=0|1|0=don't add previous description|1=add previous description to new description // GetOnlyCover=0|0|0=Process all fields|1=Get Only Cover from previous URL (Adult DVD Empire or AdultDVDMarketplace or Adult Supply Warehouse) // GetActressesInfo=1|1|0=Don't get actresses info|1=Get actresses info (has a pierced tongue?) // fine riportare uses StringUtils7552; var MovieName, pagina, pagestr, MovieNameHy: string; MovieURL, TheMovieAddress: string; performers: string; PageURL: TStringList; Line, strtmp, initchar, endchar: string; LineNr, Beginaddress, EndAddress, pos_endChar, http_pos: Integer; const BaseURL = 'https://www.iafd.com/'; debug_search = false; debug_film = false; folder = 'H:\Complete Movies\Test\'; Apice =#39; // --- function UTF8Dec(AText: string): string; begin Result := UTF8Decode(AText); if Result = '' then Result := AText; // in case of a UTF8 decoding error end; function RemovePar(wholetext: string) : string; var str1: String; i: Integer; begin str1 := Trim(TextBefore(wholetext, '(', '')); if str1 <> '' then begin if Pos(')', RemainingText) > 0 then wholetext := str1+' '+Trim(TextAfter(RemainingText, ')')); // + end of text or '' end; result := Trim(wholetext); end; // --- procedure AnalyzeSearchPage(Address: string); var Page, Page2: TStringList; BeginPos: integer; begin Page := TStringList.Create; Page.Text := GetPage(Address); pagestr := Page.Text; if debug_search then DumpPage(folder+'IAFD_search.html', Pagestr); // debug LineNr := FindLine('notfound - iafd.com - internet adult film database', Page, 0); if LineNr<>-1 then begin if GetOption('AutoSelect') = 0 then ShowError('No match ' + UpperCase(MovieName)); Page.Free; exit; end; LineNr := FindLine('Showing 1 to 1 of 1 entries', Page, 0); if LineNr<>-1 then begin if GetOption('AutoSelect') = 0 then ShowError('No match ' + UpperCase(MovieName)); Page.Free; exit; end; LineNr := FindLine('
Minutes
', Page, LineNr); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); HTMLRemoveTags(strTmp); strTmp := fulltrim(StringReplace(strTmp, 'Minutes', '')); SetField(fieldLength, strTmp); end; // Directors LineNr := FindLine('Director', Page, LineNr); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); HTMLRemoveTags(strTmp); strTmp := StringReplace(strTmp, #9, ''); strTmp := StringReplace(strTmp, 'Directors', ''); strTmp := StringReplace(strTmp, 'Director', ''); SetField(fieldDirector, UTF8Dec(strTmp)); end; // Distributor LineNr := FindLine('
Distributor
', Page, LineNr); if LineNr <> -1 then begin // strTmp := Page.GetString(LineNr+1); strTmp := Page.GetString(LineNr); HTMLRemoveTags(strTmp); strTmp := StringReplace(RemovePar(strTmp), #9, ''); strTmp := StringReplace(strTmp, 'Distributor', ''); SetField(fieldProducer, UTF8Dec(strTmp)); end; scene := ''; // Also Known As LineNr := FindLine('Also Known As', Page, 0); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); strTmp := StringReplace(StrTmp, 'All-Girl
', Page, LineNr); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); HTMLRemoveTags(strTmp); strtmp := StringReplace(strtmp, 'All-Girl', ''); strTmp := UTF8Dec(fulltrim(strTmp)); if strTmp <> '' then Scene := Scene + '- All-Girl: ' + strTmp + '; '; end; // All-men LineNr := FindLine('All-Male
', Page, LineNr); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); HTMLRemoveTags(strTmp); strtmp := StringReplace(strtmp, 'All-Male', ''); strTmp := UTF8Dec(fulltrim(strTmp)); if strTmp <> '' then Scene := Scene + '- All-Male: ' + strTmp + '; '; end; // Compilation LineNr := FindLine('Compilation
', Page, LineNr); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); HTMLRemoveTags(strTmp); strtmp := StringReplace(strtmp, 'Compilation', ''); strTmp := fulltrim(strTmp); if strTmp <> '' then Scene := Scene + '- Compilation: ' + strTmp + CRLF; end; // Comments LineNr := FindLine('In an effort to provide with you with choices, the IAFD has partnered with leading online retailers to provide you with purchase options. If you see an item that does not belong to this movie, or would like to suggest a retailer we should partner with, please use the "Submit Corrections" button above to let us know.
', ''); HTMLRemoveTags(strTmp); strTmp := Stringreplace(Strtmp, 'Click here for a guide to the ratings.', ''); Scene := Scene + strTmp; end; setfield(Fieldcomments, UTF8Dec(Scene)); // Actress & Actors LineNr := FindLine('PopPorn - $39.99' trova_cover := 'href="'; strTmp := BaseURL + TextBetween(strTmp, trova_cover, '"'); Page_cover.Text := GetPage(strTmp); Pagestr := Page_cover.Text; if debug_film then DumpPage(folder+'IAFD_PopPorn.html', Pagestr); // debug trova_cover := ' -1 then begin strTmp := Page_cover.GetString(LineNr); strTmp := TextBetween(strTmp, 'href="', '"'); GetPicture (strTmp); Pict_dim := GetPictureSize; if Pict_dim > 22000 then cover_ok := 'yes_PopPorn'; end; end; end; // HotMovies if cover_ok = 'no' then begin LineNr := FindLine('>HotMovies<', Page, 0); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); trova_cover := 'href="'; strTmp := BaseURL + TextBetween(strTmp, trova_cover, '"'); Page_cover.Text := GetPage(strTmp); if debug_film then DumpPage(folder+'IAFD_HotMovies.html', Pagestr); // debug trova_cover := ' -1 then begin strTmp := Page_cover.GetString(LineNr); strTmp := TextBetween(strTmp, 'content="', '"'); GetPicture (strTmp); Pict_dim := GetPictureSize; if Pict_dim > 22000 then cover_ok := 'yes_HotMovies'; end; end; end; end; // CD Universe NON FUNZIONA CAUSA ACCESSO NEGATO AI ROBOTS! if cover_ok = 'no' then begin LineNr := FindLine('>CD Universe<', Page, 0); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); trova_cover := 'href="'; strTmp := BaseURL + TextBetween(strTmp, trova_cover, '"'); // https://www.cduniverse.com/productinfo.asp?PID=1594953&style=ice&frm=lk_iafdcomg // strTmp := stringReplace(strTmp, ' Page_cover.Text := GetPage(strTmp); Pagestr := Page_cover.text; if debug_film then DumpPage(folder+'IAFD_CD_universe.html', Pagestr); // debug trova_cover := ' -1 then begin strTmp := Page_cover.GetString(LineNr); strTmp := TextBetween(strTmp, 'src="', '"'); GetPicture (strTmp); Pict_dim := GetPictureSize; if Pict_dim > 22000 then cover_ok := 'yes_HotMovies'; end; end; end; // AdultDVDMarketplace NON FUNZIONA CAUSA ACCESSO NEGATO AI ROBOTS! if cover_ok = 'no' then begin LineNr := FindLine('>AdultDVDMarketplace<', Page, 0); if LineNr <> -1 then begin strTmp := Page.GetString(LineNr); trova_cover := ' href="/'; strTmp := BaseURL + TextBetween(strTmp, trova_cover, '"'); Page_cover.Text := GetPage(strTmp); Pagestr := Page_cover.Text; if debug_film then DumpPage(folder+'IAFD_AdultDVDMarketplace.html', Pagestr); // debug trova_cover := 'fancybox-button'; LineNr := FindLine(trova_cover, Page_cover, 0); if LineNr <> -1 then begin strTmp := Page_cover.GetString(LineNr); strTmp := TextBetween(strTmp, 'href="', '"'); GetPicture (strTmp); Pict_dim := GetPictureSize; if Pict_dim > 220000 then cover_ok := 'yes_HotMovies'; end; end; end; cover_ok := Cover_ok; //per debug end; //------------------------------------------------------------------------------ begin SetField(fieldChecked, ''); if (GetOption('GetOnlyCover') = 1) then begin MovieURL := GetField(fieldURL); if MovieURL <> '' then begin if Pos(BaseURL,MovieURL) > 0 then begin PageURL := TStringList.Create; PageURL.Text := GetPage(MovieURL); Pagestr := Page.Text; if debug_film then DumpPage(folder+'IAFD_cover1.html', Pagestr); // debug FindCover(PageURL); SetField(fieldChecked, 'x'); PageURL.Free end; end; exit; end; MovieName := GetField(fieldTranslatedTitle); if MovieName = '' then MovieName := GetField(fieldOriginalTitle); if Input('I.A.F.D. Import', 'Digita il titolo del film:', MovieName) then //FS2020-enter filename begin //FS2020-enter filename if (GetOption('AutoSelect') = 0) or (MovieName = '') then if Input('IAFD Import', 'Input title:', MovieName) = False then exit; http_pos := pos('https', MovieName); if http_pos = 1 then pagina := MovieName else begin MovieName := Trim(StringReplace(MovieName, 'Penthouse' , '')); if Pos(MovieName, 'The ') = 1 then MovieName := Trim(StringReplace (MovieName), 'The ' , ''))); MovieName := StringReplace (MovieName, '_' , ' '); MovieName := LowerCase(StringReplace (MovieName, '.' , ' ')); MovieName := StringReplace(MovieName, ' ', '+'); pagina := BaseURL + 'results.asp?searchtype=comprehensive&searchstring=' + UrlEncode(MovieName); end; AnalyzeSearchPage(pagina); end; //FS2020-enter filename end.