Author Topic: Script: TheMovieDB [ES] (Easy API Script)  (Read 58774 times)

0 Members and 1 Guest are viewing this topic.

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Script: TheMovieDB [ES] (Easy API Script)
« on: January 19, 2014, 11:19:11 am »
I attached my script to scrape the information of the web TheMovieDB in Spanish. It is made on the basis of 'FilmAffinity [ES] 2014' script with some improvements.
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: June 12, 2017, 09:54:20 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #1 on: January 19, 2014, 03:29:48 pm »
Script works fine, but does have drawback:

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
« Last Edit: January 19, 2014, 07:05:04 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: TheMovieDB [ES] 2014 (Easy Script)
« Reply #2 on: January 19, 2014, 08:54:12 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).
                             Improvements: RemoveTags (Simplify the Web delimitators choice)
                                           Search only in movies
(Edito: New version down)
« Last Edit: December 06, 2014, 07:07:50 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #3 on: January 20, 2014, 10:42:10 am »
Yeah, now that's fine, but the problem is AKA field:

In movie Lolita(1962) note the this one record in AKA field
Code: [Select]
About TMDb,Contact Us,API,API Libraries
For other movie I've tested is OK, but there is a small cosmetic problem, appears as follows
Code: [Select]
100 Ragazze,100 Garotas,100 chicas,100 Filleson the web site is as follows:100 chicas(2000)
Code: [Select]
100 Ragazze
100 Garotas
100 chicas
100 Filles
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #4 on: January 20, 2014, 04:48:26 pm »
TheMovieDB plugin 0.1.1.2 now correctly interprets the language option...
Gentlemen, you can’t fight in here! This is the War Room!

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #5 on: January 20, 2014, 08:27:56 pm »
Thank you very much another time Ivek23. I think I've corrected the mistakes you point me (even failure aka commas separators instead of line breaks).

            v 0.1.3.0   VVV: Corrected error when web aka field has no value and the field PVD separator <br>.
                             Changed Script constant option GET_ACTORS_INFO_URL.
(Edito: New version down)

(Thanks to nostra too about the new TheMovieDB plugin 0.1.1.2. always better that my script)
« Last Edit: December 06, 2014, 07:08:18 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #6 on: January 21, 2014, 08:48:02 am »
That's it, now it's fine, thank you.

(Thanks to nostra too about the new TheMovieDB plugin 0.1.1.2. always better that my script)

Correction, now v 0.1.1.3 is here.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #7 on: January 21, 2014, 03:08:13 pm »
I wonder where and how to add, for example, "Part of the:" custom field (as well as other custom fields) in the script.

How can I add the url in the custom field for for example:
8 Mile (2002) Movie Webpage URL link, which should be as follows in a custom box
Code: [Select]
<link url="http://movies.uip.de/8mile/">Link</link> or
Code: [Select]
<link url="http://movies.uip.de/8mile/">http://movies.uip.de/8mile/</link>
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #8 on: January 21, 2014, 04:00:49 pm »
To fill custom field use function: AddCustomFieldValueByName
See: http://www.videodb.info/help/hlp_scripting.html#fill
Gentlemen, you can’t fight in here! This is the War Room!

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #9 on: January 21, 2014, 08:09:23 pm »
To fill custom field use function: AddCustomFieldValueByName
See: http://www.videodb.info/help/hlp_scripting.html#fill

Thanks for the tip and idea.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #10 on: January 24, 2014, 07:48:21 pm »
Adding a script in English with some additional custom fields.
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: TheMovieDB [ES] 2014 (Easy Script)
« Reply #11 on: January 29, 2014, 10:34:14 pm »
 I think I've corrected the mistakes and make some improvements:

v 0.1.4.0   VVV: Clean URL to PVD (now estándar, same that TheMovieDB plugin 0.1.1.3).
                        Language Web info constant LANG_STR (easy adaptation to other languages).
                        Get USA 'contentRating' = MPAA

(Edito: New version down)
« Last Edit: December 06, 2014, 07:09:13 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #12 on: January 30, 2014, 03:56:48 pm »
I made a few corrections:

MPAA
1 a.) MPAA code I Fixed
Code: [Select]
  //Get ~mpaa~ ~Release Rating~
    //endPos:=curPos;
HTML:=StringReplace(HTML,'-','',True,False,False);
HTML:=StringReplace(HTML,'PG13','PG-13',True,False,False);
    PVDField:='mpaa';                                                                                              //For easy programation
    WebFieldText:='      MPAA:';                                                                                   //Only for Debuging
    WebFieldOpen:='<img src="http://d3a8mw37cqal2z.cloudfront.net/assets/36eefb4c632941c/images/flags/us.png" />'; //WEB_SPECIFIC
    WebFieldBegin:='</span>';                                                              //WEB_SPECIFIC
    WebFieldEnd:='</p>';    //WEB_SPECIFIC
curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);


1 b.) MPAA code I've moved since then more correct data transfer
Code: [Select]
  //Get ~Lenght~. (User option GET_LENGTH)
    if GET_LENGTH then begin
      PVDField:='length';                         //For easy programation
      WebFieldText:='      Length:';              //Only for Debuging
      WebFieldOpen:='<strong>Runtime:</strong>';  //Web only one value. WEB_SPECIFIC
      WebFieldBegin:='<span id="runtime">';       //WEB_SPECIFIC
      WebFieldEnd:='</span>';                     //WEB_SPECIFIC
      curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);
    end;

  //Get ~mpaa~ ~Release Rating~
    //endPos:=curPos;
HTML:=StringReplace(HTML,'-','',True,False,False);
HTML:=StringReplace(HTML,'PG13','PG-13',True,False,False);
    PVDField:='mpaa';                                                                                              //For easy programation
    WebFieldText:='      MPAA:';                                                                                   //Only for Debuging
    WebFieldOpen:='<img src="http://d3a8mw37cqal2z.cloudfront.net/assets/36eefb4c632941c/images/flags/us.png" />'; //WEB_SPECIFIC
    WebFieldBegin:='</span>';                                                              //WEB_SPECIFIC
    WebFieldEnd:='</p>';    //WEB_SPECIFIC
curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);

2 .) procedure ParseSearchResults I fixed it cleaned URL:
Code: [Select]
const
// Web delimiters. Null '' value it's not valid. WEB_SPECIFIC
    WebSearchListOpen = '<ul class="search_results movie">';                    //String which opens the Web Search List data. WEB_SPECIFIC
    WebSearchResultOpen = '<div class="poster">';                               //String which opens the Web Result data. WEB_SPECIFIC
    WebSearchResultPreviewURLOpen = '<a href="';                                  //String which opens the Web Result PreviewURL data. WEB_SPECIFIC
    WebSearchResultPreviewURLBegin = '" src="';                              //String which opens the Web Result PreviewURL text. WEB_SPECIFIC
    WebSearchResultPreviewURLEnd = '" width';                                 //String which closes the Web Result PreviewURL text. WEB_SPECIFIC
    WebSearchResultDataOpen = '<div class="info">';                             //String which opens the Web URL+Title+Year data. WEB_SPECIFIC
    WebSearchResultURLBegin = '<h3><a href="';                                  //String which opens the Web Result URL text. WEB_SPECIFIC
    //WebSearchResultURLEnd = '" t';                                               //String which closes the Web Result URL text. WEB_SPECIFIC
    WebSearchResultURLEnd = '-';                                               //String which closes the Web Result URL text. WEB_SPECIFIC
WebSearchResultTitleBegin = 'itle="';                                      //String which opens the Web Result Title text. WEB_SPECIFIC
    WebSearchResultTitleEnd = '">';                                              //String which closes the Web Result Title text. WEB_SPECIFIC
    WebSearchResultYearBegin = 'span>(';                                       //String which opens the Web Result Year text. WEB_SPECIFIC
    WebSearchResultYearEnd = ')</span>';                                        //String which closes the Web Result Year text. WEB_SPECIFIC
procedure ParseSearchResults(HTML:String);

Attached to the TheMovieDB_[ES]_2014_mod script.



And yet:

Composers is Composer field in PVD.

Code: [Select]
'3_CreditType' composer
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: TheMovieDB [ES] 2014 (Easy Script)
« Reply #13 on: February 03, 2014, 07:01:21 pm »
Thank you very much another time Ivek23. I think I've corrected the mistakes you point me.
CHANGE LOG:
 v 0.1.5.0   VVV: 'Set_CustomField' 'Set' for sagas(Part Of The)
                 Ivek23: MPAA code I've moved since then more correct data transfer (after Length)
                 Ivek23&VVV: MPAA code I Fixed (Now prevents movies not Released in USA or with not MPAA information)
                 Ivek23: Procedure ParseSearchResults I fixed it cleaned URL (End of URL '-')
                 VVV: Detect movies not traslated to LANG_STR.

(Edito: New version down)
« Last Edit: December 06, 2014, 07:09:39 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #14 on: February 05, 2014, 03:46:49 pm »
Compliment is a welcome.

I apologize for the delayed response, the fault lies in the extremely bad weather from Thursday onwards, particularly bad weather from Sunday till today [across the country (Slovenia) was a few cm Ice hug and thus remained a lot of people, even without electricity, also with us].
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: TheMovieDB [ES] 2014 (Easy Script)
« Reply #15 on: February 05, 2014, 10:53:07 pm »
Thanks Ivek23 for your interest and education. I've done make some improvements:

CHANGE LOG (05/02/2014):
            v 0.1.6.0   VVV: Prevents severals Web missings informations (Tags, Crew, etc)

(Edito: New version down)
« Last Edit: December 06, 2014, 07:10:18 pm by VVV_Easy_Programing »

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #16 on: February 06, 2014, 07:58:25 pm »
Minor change:

CHANGE LOG (06/02/2014):
            v 0.1.7.0   VVV: In TV Series reject download.

(Edito: New version down)
« Last Edit: December 06, 2014, 07:10:31 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #17 on: February 08, 2014, 03:07:08 pm »
Thank improvements are welcomed to script works better.

What about the script for the series, is possible be do.
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: TheMovieDB [ES] 2014 (Easy Script)
« Reply #18 on: February 12, 2014, 07:49:06 pm »
I have not really many series (and also not have much time) :'(.
I have a good collection of movies that I see from disk (on travel) and XBMC (at home).
After much searching PVD is the most powerful and flexible data base in order to be adapted.
I begin with FileBot, then I captured and exported the movies with PVD.
After I use templates for XBMC and TViXie (for create a image file with movie information).
I hope that you keep this program and you never tire. Thanks for your good work.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #19 on: February 23, 2014, 07:11:15 am »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD