Author Topic: Script: FilmAffinity [ES] (Easy Script)  (Read 95387 times)

0 Members and 2 Guests are viewing this topic.

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Script: FilmAffinity [ES] (Easy Script)
« on: January 17, 2014, 06:29:06 pm »
I attached my script to scrape the information of the web Spanish FilmAffinity. If you want to try use the name of movies in Spanish  "La vida de Pi"="Life of Pi" (finds at first) or "Padrino"="Godfather" to search by list (the script no handles advanced search).
On the other hand I tried to make it as easy as possible to understand for subsequent public use. It also includes an example so that it can adapt. I copy the introduction of Script:
"  This is a script designed to be easy to understand and to adapt. For this reason may be missing some fields and
  the programming may not be smart. It's a only "One Pass" Script and get data in WEB SECUENTIAL ORDER.
  The Personal Video Data field names in comments are enclosed in "~" so they are easier to find in the script.
  The WEB_SPECIFIC comentary points out the specific text for Web fields.
  Use with your editor's search function to find applicable code sections and adapt script."
 (Edito: New version down)
« Last Edit: November 22, 2015, 09:44:23 pm by VVV_Easy_Programing »

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] (Easy Script)
« Reply #1 on: January 18, 2014, 02:23:46 pm »
v 0.1.1.0   VVV: Minor corrections and ameliorations
« Last Edit: November 22, 2015, 09:44:40 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2740
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #2 on: January 19, 2014, 03:26:40 pm »
Script works fine, but does have some drawbacks, namely:

1.  Instead of this
Code: [Select]
  //Get ~Duration~. (User option GET_DURATION)
    if GET_DURATION then begin
      PVDField:='duration';
.
.
.
must be as follows
Code: [Select]
  //Get ~Duration~. (User option GET_DURATION)
    if GET_DURATION then begin
      PVDField:='length';
.
.
.
duration is incorrectly displayed
Code: [Select]
web page           PVD field
91 min                0:01:31
152 min              0:02:33
proper duration is as follows
Code: [Select]
web page           PVD field
91 min                1:31:00
152 min              2:32:00


2.  Year in some movies do not pass, here are some links:
http://www.filmaffinity.com//es/film485513.html
http://www.filmaffinity.com//es/film642021.html
http://www.filmaffinity.com//es/film345561.html
http://www.filmaffinity.com//es/film557483.html

3.  Genre in some movies is not transferred correctly, here are a few links:
http://www.filmaffinity.com//es/film560132.html
Quote
Drama, Romance, Premios                1962, 1962, CrÍticas                                                                   La maravillosa novela de Nabokov tuvo una excelent, Kubrick se atreve con la turbulenta relación de un padrastro y su hija adolescente, creando una película bella, sugerente y desgarradora sobre la perversa obsesión de la naturaleza humana. La polémica ya estaba servida de antemano, pero el arte acalló las voces religiosas que se levantaron contra su exhibición. Muy buena.                     Pablo Kurt: F, vigoroso y arriesgado ejercicio de puesta en pantalla que nos abre al Kubrick en plena posesión de su talento"               , La maravillosa novela de Nabokov tuvo una excelente adaptación cinematográfica a cargo de otro maestro singular. Así, Pablo Kurt: FILMAFFINITY                                                                            "Gran cine e inteligente, "Gran cine e inteligente, Ángel Fdez. Santos: Diario El País, Puedes hacer una crÍtica de esta pelÍcula para que el resto de los usuarios la pueda leer.            AÑade tu crÍtica, AÑade tu crÍtica, Votaciones de almas gemelas                                        RegÍstrate, RegÍstrate, PosiciÓn rankings listas                                                55 Mis adaptaciones de libros / novelas preferidas, 55 Mis adaptaciones de libros / novelas preferidas, Mis adaptaciones de libros / novelas preferidas, Las películas más eróticas que recuerdo, Mis películas británicas & irlandesas favoritas (NUEVA LISTA), Si alguna sinopsis cuenta demasiados detalles del argumento -o para corregir errores o completar datos de la ficha- por favor, mensaje, AÑade FA a tus webs favoritas, FA en Facebook
http://www.filmaffinity.com//es/film619271.html
Quote
Terror, http://www.theasylum.cc/product.php?id=229, Puedes hacer una crÍtica de esta pelÍcula para que el resto de los usuarios la pueda leer.            AÑade tu crÍtica, AÑade tu crÍtica, Votaciones de almas gemelas                                        RegÍstrate, RegÍstrate, Si alguna sinopsis cuenta demasiados detalles del argumento -o para corregir errores o completar datos de la ficha- por favor, mensaje, AÑade FA a tus webs favoritas, FA en Facebook
« Last Edit: January 19, 2014, 07:04:21 pm by Ivek23 »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #3 on: January 19, 2014, 07:45:34 pm »
Thank you very much for your work. I think I've corrected the mistakes you point me:

v 0.1.2.0   VVV: Corrections: Duration (field name and length in seconds), genres (movies without category).
                         Improvements: RemoveTags (Simplify the Web delimitators choice)

(The year works fine now without knowing why)
Attached the new version
« Last Edit: January 20, 2014, 06:59:49 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2740
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #4 on: January 20, 2014, 09:44:48 am »
(The year works fine now without knowing why)

Hi, I think I found a solution for year movie, I tested a few movies and it works fine (see attached image).

Here is the solution:
Code: [Select]
procedure ParseMovie(HTML:String;MovieURL:AnsiString);
  var
    curPos,endPos:Integer;
    PVDField,Years,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd,WebItemBegin,WebItemEnd:String;
  begin
    LogMessage('procedure ParseMovie');
.
.
.
  //Get ~year~
    PVDField:='year';                           //For easy programation
    WebFieldText:='      Year:';                //Only for Debuging
    WebFieldOpen:='<dt>Ańo</dt>';               //Web only one value. WEB_SPECIFIC
    WebFieldBegin:='<dd>';                      //WEB_SPECIFIC
    WebFieldEnd:='</dd>';                       //WEB_SPECIFIC
endPos:=endPos+Length(WebFieldOpen);
    curPos:=PosFrom(WebFieldBegin,HTML,curPos)+Length(WebFieldBegin);
    endPos:=PosFrom(WebFieldEnd,HTML,curPos);
    Years:= Copy(HTML,curPos,endPos - curPos);
    //curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);
    AddFieldValueXML(PVDField,Years);
    LogMessage('    Years:'+Years+'||'+PVDField);

  //Get ~Lenght~. (User option GET_LENGTH)
.
.
.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #5 on: January 20, 2014, 07:11:25 pm »
Thank you very much another time. I think I've corrected the mistakes you point me (without spoiling it for other users)

            v 0.1.3.0   VVV: Roundabout for the spanish letter of <dt>Año</dt>". Some user see as "<dt>Ańo</dt>".

(I do not know if the problem is given by the function HTMLToText that converts  "<dt>A&ntilde;o</dt>"  different depending on regional configuration. I made a roundabout replacing the text sent by Ivek23 but i cann't test it)

Attached the new version
« Last Edit: January 21, 2014, 08:14:10 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2740
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #6 on: January 21, 2014, 08:37:58 am »
Does not work, I add my modification of scripts, which normally displays year of the movie.
« Last Edit: January 21, 2014, 08:39:34 am by Ivek23 »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #7 on: January 21, 2014, 08:17:26 pm »
It works for you and me! Thank you very much.

        v 0.1.4.0   VVV: Officialized Ivek23 modify for the year problem.

Attached the new version
« Last Edit: September 21, 2014, 07:14:06 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2740
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #8 on: February 08, 2014, 03:06:28 pm »
Thanks, it's OK.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Am-rA

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #9 on: May 25, 2014, 01:09:47 am »
something happened that no longer works   :-\

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #10 on: September 21, 2014, 07:13:49 pm »
CHANGE LOG:
            v 0.1.4.2   VVV: Adjust WEB_SPECIFIC to new API.

Attached the new versión
(Edito: New version down)
« Last Edit: December 27, 2014, 03:25:23 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2740
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #11 on: September 22, 2014, 06:25:14 pm »
Thanks, script works fine.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Am-rA

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #12 on: September 23, 2014, 12:51:16 am »
Thanks, perfect work

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #13 on: December 27, 2014, 03:28:00 pm »
Completely redone  :) :D :). The structure of the script is linear.

CHANGE LOG (26/12/2014):
            V 0.2.0.0   VVV: Rebuild script.

Attached the new versión
(If some movie fails, please send me the title, the bad information and the search language. Thank you.)
(Edito: New version down)
« Last Edit: December 27, 2014, 08:31:55 pm by VVV_Easy_Programing »

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #14 on: December 27, 2014, 08:34:24 pm »
CHANGE LOG (27/12/2014):
            V 0.2.0.1   VVV: Add (needs Custom Field ~FilmAffinity_Votes~) for 'votos'

Attached the new versión
(Edito: New version down)
« Last Edit: December 28, 2014, 12:33:59 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2740
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #15 on: December 27, 2014, 10:33:27 pm »
Script only display the search results, but does not transfer any information for any movie, because it is always redirected to the search results, but not the movie page of the search of the movie. No transfer of any url address.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #16 on: December 28, 2014, 12:35:10 pm »
CHANGE LOG (28/12/2014):
            V 0.2.0.2   VVV: Fixed bug with movie first search and download (Ivek23 detected)

Attached the new versión
(Edito: New version down)

Thanks Ivek23
« Last Edit: January 31, 2015, 11:07:20 am by VVV_Easy_Programing »

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #17 on: January 31, 2015, 11:08:37 am »
CHANGE LOG (31/01/2015):
            V 0.2.1.0   VVV: Adjust WEB_SPECIFIC to new API (AKA Bouton).

Attached the new versión
(Edito: New version down)
« Last Edit: September 13, 2015, 10:44:36 am by VVV_Easy_Programing »

Offline Am-rA

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #18 on: January 31, 2015, 11:54:02 am »
Work fine , tnks ;D

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2740
    • View Profile
Re: Script: FilmAffinity [ES] 2014 (Easy Script)
« Reply #19 on: February 02, 2015, 09:09:57 am »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD