Personal Video Database
English => Development => Scripts and Templates => Topic started by: VVV_Easy_Programing 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)
-
Script works fine, but does have drawback:
1. Instead of this //Get ~Duration~. (User option GET_DURATION)
if GET_DURATION then begin
PVDField:='duration';
.
.
.
must be as follows
//Get ~Duration~. (User option GET_DURATION)
if GET_DURATION then begin
PVDField:='length';
.
.
.
duration is incorrectly displayed
web page PVD field
91 min 0:01:31
152 min 0:02:33
proper duration is as follows
web page PVD field
91 min 1:31:00
152 min 2:32:00
-
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)
-
Yeah, now that's fine, but the problem is AKA field:
In movie Lolita(1962) (http://www.themoviedb.org/movie/802-lolita?language=es) note the this one record in AKA fieldAbout TMDb,Contact Us,API,API Libraries
For other movie I've tested is OK, but there is a small cosmetic problem, appears as follows100 Ragazze,100 Garotas,100 chicas,100 Filles
on the web site is as follows:100 chicas(2000) (http://www.themoviedb.org/movie/10035-100-girls?language=es)100 Ragazze
100 Garotas
100 chicas
100 Filles
-
TheMovieDB plugin 0.1.1.2 now correctly interprets the language option...
-
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)
-
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. (http://www.videodb.info/forum_en/index.php?action=down)
-
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 (http://www.themoviedb.org/movie/65) Webpage URL link, which should be as follows in a custom box<link url="http://movies.uip.de/8mile/">Link</link>
or <link url="http://movies.uip.de/8mile/">http://movies.uip.de/8mile/</link>
-
To fill custom field use function: AddCustomFieldValueByName
See: http://www.videodb.info/help/hlp_scripting.html#fill
-
To fill custom field use function: AddCustomFieldValueByName
See: http://www.videodb.info/help/hlp_scripting.html#fill
Thanks for the tip and idea.
-
Adding a script in English with some additional custom fields.
-
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)
-
I made a few corrections:
MPAA
1 a.) MPAA code I Fixed //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 //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:
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.
'3_CreditType' composer
-
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)
-
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].
-
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)
-
Minor change:
CHANGE LOG (06/02/2014):
v 0.1.7.0 VVV: In TV Series reject download.
(Edito: New version down)
-
Thank improvements are welcomed to script works better.
What about the script for the series, is possible be do.
-
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.
-
Thanks for your good work.
Same to you.
-
CHANGE LOG (21/09/2014):
v 0.1.7.1 VVV: Adjust WEB_SPECIFIC to new API.
(Edito: New version down)
-
Thanks, script works fine, but find a small cosmetic bug in Actors:
Info in Actors field
John Wayne ... s Col John Marlowe
William Holden ... s Major 'Hank' Kendall
Constance Towers ... s Miss Hannah Hunter
Judson Pratt ... s Sgt Major Kirby
and part of code
Delete(Role,1,Length(' as ')); //WEB_SPECIFIC
After correcting this part of the code
Delete(Role,1,Length(' as ')); //WEB_SPECIFIC
and the info in Actors field such without cosmetic defects
John Wayne ... Col John Marlowe
William Holden ... Major 'Hank' Kendall
Constance Towers ... Miss Hannah Hunter
Judson Pratt ... Sgt Major Kirby
The correction in this part of the code:
function GetPVDMoviePersonListValue
//===============================
const
// Web delimiters. Null '' value it's not valid. WEB_SPECIFIC
WebCreditURLBegin = '<a href="'; //String which opens the Web Result URL text. WEB_SPECIFIC
WebCreditURLEnd = '" itemprop="url">'; //String which closes the Web Result URL text. WEB_SPECIFIC
WebCreditPhotoURLBegin = '<img src="'; //For Actors: String which opens the Web Result Photo URL text. WEB_SPECIFIC
WebCreditPhotoURLEnd = '" width='; //For Actors: String which closes the Web Result Photo URL text. WEB_SPECIFIC
WebCreditNameBegin = '<span itemprop="name">'; //String which opens the Web Result Name text. WEB_SPECIFIC
WebCreditNameEnd = '</span>'; //String which closes the Web Result Name text. WEB_SPECIFIC
WebCreditRoleBegin = '</a>'; //For Actors: String which opens the Web Result Role text. WEB_SPECIFIC
WebCreditRoleEnd = '</span>'; //For Actors: String which closes the Web Result Role text. WEB_SPECIFIC
function GetPVDMoviePersonListValue(HTML:String ;Pos:Integer;PVDCreditType:Integer;WebCreditText:String;WebCreditOpen:String;WebFieldBegin:String; WebFieldEnd:String):Integer;
var
curPos,endPos,endPosList :Integer;
Name,Role,URL:String;
begin
LogMessage('procedure GetPVDMoviePersonListValue');
//PVDCreditType - Personal Video Database credit type
//WebCreditText - Name of Web Credit. Only for Debuging option.
//WebCreditOpen - String which opens the Web Credit data.
curPos:=PosFrom(WebCreditOpen,HTML,Pos)+Length(WebCreditOpen);
endPosList:=PosFrom(WebFieldEnd,HTML,curPos);
curPos:=PosFrom(WebFieldBegin,HTML,curPos)+Length(WebFieldBegin);
while curPos < endPosList do begin
LogMessage('Parsing search Person results in '+IntToStr(curPos)+' ...');
//Get URL + Name
URL:='';
Name:='';
Role:='';
curPos:=PosFrom(WebCreditURLBegin,HTML,curPos)
if (0<curPos) and (curPos<endPosList) then begin
if GET_ACTORS_INFO_URL then begin
curPos:=curPos+Length(WebCreditURLBegin);
endPos:=PosFrom(WebCreditURLEnd,HTML,curPos);
URL:=BASE_URL+Copy(HTML,curPos,endPos - curPos);
end else if PVDCreditType=ctActors then begin //For Actors changed a Photo URL. WEB_SPECIFIC
curPos:=PosFrom(WebCreditPhotoURLBegin,HTML,curPos)
curPos:=curPos+Length(WebCreditPhotoURLBegin);
endPos:=PosFrom(WebCreditPhotoURLEnd,HTML,curPos);
URL:=Copy(HTML,curPos,endPos - curPos);
URL:=StringReplace(URL,'w45','original',True,True,False); //WEB_SPECIFIC
end;
LogMessage(' Parse Results Person URL:'+URL+'||'+IntToStr(PVDCreditType));
curPos:=PosFrom(WebCreditNameBegin,HTML,curPos)+Length(WebCreditNameBegin);
endPos:=PosFrom(WebCreditNameEnd,HTML,curPos);
Name:=RemoveTags(Copy(HTML,curPos,endPos - curPos),False);
LogMessage(' Parse Results Person Name:'+Name+'||'+IntToStr(PVDCreditType));
curPos:=endPos+Length(WebCreditNameEnd);
if (PVDCreditType=ctActors) then begin
curPos:=PosFrom(WebCreditRoleBegin,HTML,curPos); //For Actors gets Role
curPos:=curPos+Length(WebCreditRoleBegin);
endPos:=PosFrom(WebCreditRoleEnd,HTML,curPos);
Role:=Copy(HTML,curPos,endPos - curPos);
Role:=RemoveTags(Role,False); //WEB_SPECIFIC
Delete(Role,1,Length(' as ')); //WEB_SPECIFIC
Role:=Copy(Role,1,Length(Role)-Length(' ')); //WEB_SPECIFIC
LogMessage(' Parse Results Actors Role:'+Role+'||'+IntToStr(PVDCreditType));
curPos:=endPos+Length(WebCreditRoleEnd);
end;
AddMoviePerson(Name,'',Role,URL,PVDCreditType);
end else begin
curPos:=endPosList;
end;
end;
Result:=endPosList+Length(WebFieldEnd); //Last position of the list.
end;
//===============================
-
CHANGE LOG (06/12/2014):
v 0.1.7.2 VVV: Adjust WEB_SPECIFIC to new Cast API. Ivek23 improvements
Attached the new versión
(Edito: New version down)
-
Thanks, script works fine.
If the script open this option, LANG_STR = '?language=es';
but in this movie Little House on the Prairie (1974) (http://www.themoviedb.org/movie/39014) find a cosmetic bug in Overview (Description):
Info in Description field
l><html lang="es"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Little House on the Prairie (1974) — The Movie Database</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/6efb98679ac650d00fb834856373621f/stylesheets/kendo-2013.3.1119/kendo.common.min.css" media="screen" rel="stylesheet" type="text/css"> <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/77d719565ba5d76901b3a86b66fb059c/stylesheets/kendo-2013.3.1119/kendo.uniform.min.css" media="screen" rel="stylesheet" type="text/css"> <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/7fd603bea3ca164c7d1bd6e15acd6738/stylesheets/kendo.tmdb-override.css" media="screen" rel="stylesheet" type="text/css"> <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/271e6e828f0b748bb88847a73fccdc18/stylesheets/screen.css" media="screen" rel="stylesheet" type="text/css"> <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/e1e3a96883a7615a6db24c6d0e3078c8/stylesheets/common_new.css" media="screen" rel="stylesheet" type="text/css"> <link rel="apple-touch-icon-precomposed" sizes="57x57" href="http://d3a8mw37cqal2z.cloudfront.net/assets/6d26011c3446214a7a865214a8bd58eb/images/icons/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon-precomposed" sizes="60x60" href="http://d3a8mw37cqal2z.cloudfront.net/assets/90ff34e1460a1bc18e49b293b3dc07d2/images/icons/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://d3a8mw37cqal2z.cloudfront.net/assets/1195932a092f33eac3082e855d83eb8e/images/icons/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon-precomposed" sizes="76x76" href="http://d3a8mw37cqal2z.cloudfront.net/assets/5ead36dc56b6e4b3a7621e7581b106fd/images/icons/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://d3a8mw37cqal2z.cloudfront.net/assets/120461b6f34e23e689d313036f33c2c0/images/icons/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon-precomposed" sizes="120x120" href="http://d3a8mw37cqal2z.cloudfront.net/assets/88fa3f9f8b03ad1f0cfc6fb99a8ab370/images/icons/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://d3a8mw37cqal2z.cloudfront.net/assets/1946cd97a5e4433294397d654c3bc1c6/images/icons/apple-touch-icon-144x144.png"> <link rel="apple-touch-icon-precomposed" sizes="152x152" href="http://d3a8mw37cqal2z.cloudfront.net/assets/99390dc2b4ae2fec3244f748685b471f/images/icons/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon-precomposed" sizes="180x180" href="http://d3a8mw37cqal2z.cloudfront.net/assets/d400682e22f0e9b495267602a5eed761/images/icons/apple-touch-icon-180x180.png"> <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/b986ddc8926c02722708d06c001032a4/images/icons/favicon-16x16.png" sizes="16x16"> <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/654d36c26057026531e1a3eafc4c900c/images/icons/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/81c45b25939d2fbd6acc7a67eb31dca9/images/icons/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/106d4ebe075848cf21d73763aad08b5a/images/icons/favicon-160x160.png" sizes="160x160"> <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/510b44c7a8e6b8119d1c5f7d105de612/images/icons/favicon-192x192.png" sizes="192x192"> <link rel="canonical" href="http://www.themoviedb.org/movie/39014-little-house-on-the-prairie"> <meta property="og:title" content="Little House on the Prairie" /><meta property="og:type" content="movie" /><meta property="og:url" content="https://www.themoviedb.org/movie/39014-little-house-on-the-prairie" /><meta property="og:image" content="https://image.tmdb.org/t/p/w500/eOMMPpVGpSaRz409vJRuYORmF8X.jpg" /><meta property="og:site_name" content="The Movie Database" /><meta property="fb:app_id" content="141280979243998" /> <meta name="twitter:card" content="summary" /><meta name="twitter:site" content="@themoviedb" /><meta name="twitter:title" content="Little House on the Prairie" /><meta name="twitter:description" content="Get more information about Little House on the Prairie on TMDb." /><meta name="twitter:image" content="https://image.tmdb.org/t/p/w500/eOMMPpVGpSaRz409vJRuYORmF8X.jpg" /><meta name="twitter:image:width" content="500" /><meta name="twitter:image:height" content="750" /><meta name="twitter:url" content="https://www.themoviedb.org/movie/39014-little-house-on-the-prairie" /> <meta name="description" content="The Movie Database (TMDb) is a popular, user editable database for movies and TV shows."> <meta name="keywords" content="Movies, TV Shows, Reviews, API, Actors, Actresses, Photos, User Ratings, Synopsis, Trailers, Teasers, Credits, Cast"> <meta name="viewport" content="width=device-width, user-scalable=yes"> <!--[if IE]> <link rel="stylesheet" type="text/css" href="http://d3a8mw37cqal2z.cloudfront.net/assets/e3432461116162e6b9c7aafcffd0f36a/stylesheets/ie_screen.css"></link> <![endif]--> <script src="http://d3a8mw37cqal2z.cloudfront.net/assets/a170a53120550c0f705a2c1a4c1275f2/javascripts/jquery-1.9.1.min.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> var language = "es"; var locale = "si"; var image_url = "http://d3a8mw37cqal2z.cloudfront.net/images/"; var cdn_url = "http://image.tmdb.org/"; var cdn_path = "t/p/"; var keyDown = {}; </script></head><body> <div id="container"> <div id="navbg"> </div> <div id="subnavbg" class="movie"> </div> <div id="header" class="movie"> <a href="/?language=es" alt="TMDb - The Movie Database"><img id="logo" src="http://d3a8mw37cqal2z.cloudfront.net/assets/8d0e15fe2a8e8abf7b14876f9a4f8158/images/tmdb-logo.png" alt="TMDb - The Movie Database" width="260" height="54" /></a> <div id="meta"> <ul> <li class="addNew movie"><a href="/movie/new?language=es">Add New Movie</a></li> <li class="login"><a href="https://www.themoviedb.org/login">Account Login</a></li> </ul> <p> <a href="https://www.themoviedb.org/talk">Forums</a> <a href="https://www.themoviedb.org/contribute">Contribute</a> <a href="https://www.themoviedb.org/apps">Apps</a> <a href="https://www.themoviedb.org/documentation/api">API</a> <a href="https://www.themoviedb.org/documentation/editing">Help</a> <a href="https://www.themoviedb.org/account/signup">Sign Up</a>
and part of code //Get ~description~
PVDField:='description'; //For easy programation
WebFieldText:=' Description:'; //Only for Debuging
WebFieldOpen:='<h3>Overview</h3>';
WebFieldBegin:='"description">'; //WEB_SPECIFIC
WebFieldEnd:='</p>'; //WEB_SPECIFIC
curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);
After correcting this part of the code //Get ~description~
PVDField:='description'; //For easy programation
WebFieldText:=' Description:'; //Only for Debuging
WebFieldOpen:='<h3>Overview</h3>';
WebFieldBegin:='"description">'; //WEB_SPECIFIC
WebFieldEnd:='</p>'; //WEB_SPECIFIC
if (0<endPos) and (0<PosFrom('" itemprop="description">',HTML,endPos)) then begin
curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);
end;
and the info in Description field such without cosmetic defects, the field is now empty, but only for this movie: Little House on the Prairie (1974) (http://www.themoviedb.org/movie/39014)
If the script open this option LANG_STR = '?language=en';
there these problems, which are described above in this movie Little House on the Prairie (1974) (http://www.themoviedb.org/movie/39014), I have not found, everything is working properly.
I was tested several variants, but this is the only function properly. Try it, you might find a better solution.
-
Change url address:
from the previous
http://www.themoviedb.org/
to this new url address
https://www.themoviedb.org/
Script does not work anymore.
-
Yes :'( :'(
It seems like PVdB script GET funtion does not recogniced the "https://" prefix.
If I use:
SEARCH_STR = 'http://www.themoviedb.org/search/movie?query=%s'
Log Window shows:
(11/12/2014 21:12:35) Searching movie information for: Little House on the Prairie
(11/12/2014 21:12:35) GET: http://www.themoviedb.org/search/movie?query=Little+House+on+the+Prairie
(11/12/2014 21:12:36) Redirected to: https://www.themoviedb.org/search/movie?query=Little+House+on+the+Prairie
(11/12/2014 21:12:36) IOHandler value is not valid
If I use:
SEARCH_STR = 'https://www.themoviedb.org/search/movie?query=%s'
Log Window shows:
(11/12/2014 21:17:40) Searching movie information for: Little House on the Prairie
(11/12/2014 21:17:40) GET: http://https://www.themoviedb.org/search/movie?query=Little+House+on+the+Prairie
(11/12/2014 21:17:43) Socket Error # 11001 Host not found.
I could use the api search:
http://api.themoviedb.org/3/search/movie?query=%s&api_key=0a4782bd3877917501a2d45e1198f809'
but it's more difficult ( Not Easy Script ;) ).
I will continue working but it is a shame not to correct the problem of the GET function. Any idea?
-
I could use the api search:
http://api.themoviedb.org/3/search/movie?query=%s&api_key=0a4782bd3877917501a2d45e1198f809'
but it's more difficult ( Not Easy Script ;) ).
I will continue working but it is a shame not to correct the problem of the GET function. Any idea?
Mavbe this api search:
http://api.themoviedb.org/3/search/movie?query=%s&language=en&include_adult=true&api_key=0a4782bd3877917501a2d45e1198f809
Downloading from:
http://api.themoviedb.org/3/movie/'+MovieID+'&append_to_response=alternative_titles,credits,keywords,images&language=en&api_key=0a4782bd3877917501a2d45e1198f809
-
I could use the api search:
http://api.themoviedb.org/3/search/movie?query=%s&api_key=0a4782bd3877917501a2d45e1198f809'
but it's more difficult ( Not Easy Script ;) ).
I will continue working but it is a shame not to correct the problem of the GET function. Any idea?
Mavbe this api search:
http://api.themoviedb.org/3/search/movie?query=%s&language=en&include_adult=true&api_key=0a4782bd3877917501a2d45e1198f809
Downloading from:
http://api.themoviedb.org/3/movie/'+MovieID+'&append_to_response=alternative_titles,credits,keywords,images&language=en&api_key=0a4782bd3877917501a2d45e1198f809
I've done a lot of tests, but I did not find any solutions.
Yes :'( :'(
It seems like PVdB script GET funtion does not recogniced the "https://" prefix
Unfortunately, it is true, as has already been mentioned above and there is no solution for this problem.
As shown in the present example TheMovieDB when the page is
start url address "http://" into "https://" and now the script for this page yet find search results just by using the api-key, the transfer of information from TheMovieDB web pages it does not work anymore.
I think that in the future more and more web pages start url title changed to "https://" and the script and maybe even plugins will no longer work,
because it does not use the api-key options, as is the case TheMovieDB web page.
BTW:
TheMovieDB plugin still works for now, since it uses the api-key.
-
Downloading from:
http://api.themoviedb.org/3/movie/'+MovieID+'&append_to_response=alternative_titles,credits,keywords,images&language=en&api_key=0a4782bd3877917501a2d45e1198f809
The correct url
http://api.themoviedb.org/3/movie/'+MovieID+'?append_to_response=alternative_titles,credits,keywords,images&language=en&api_key=0a4782bd3877917501a2d45e1198f809
-
Completely redone :) :D :).
It has a Rondabout in GetBaseURL for "cheat" GET PVdB funtion (the fail "https") and this allows using the standard link "http://www.themoviedb.org/movie/".
In addition, the structure of the script is linear, use the record movie_id (imdb or themoviedb) and get much more information.
CHANGE LOG (14/12/2014):
V 0.2.0.0 VVV: Adjust new API based scrip (not Web search based).
(PVdB "GET" scripts funtions doesn't work with 'https' URL).
(Edito: New version down)
I think that in the future more and more web pages start url title changed to "https://" and the script and maybe even plugins will no longer work,
because it does not use the api-key options, as is the case TheMovieDB web page.
I also afraid that :'(. As many pages do not have (or do not publish) their api_keys I tried to make a script that "would read" pages but now we know that can not work with "https". ;D PVdB new version? ;D Please ....
-
Very good job, works great, but miss the release date, because it missing in the transfer of information.
It may help this one piece of code to release date:
procedure ParseMovie(MovieURL : String; HTML : String);
var
curPos, curPos1, endPos : Integer;
Date, Released, Wpage, Wpage1, TmpStr, TmpStr0, TmpStr1, TmpStr2, TmpStr3 : String;
DateParts: TWideArray;
begin
//Date ~Updated~ (choose simple or verbose version)
Date := DateToStr(CurrentDateTime);
if Date <> '' then
begin
ExplodeString(Date, DateParts, '-');
Date := DateParts[2] +'.'+ DateParts[1] +'.'+ DateParts[0];
Date := StringReplace(Date, '01.', '1.', True, True, False);
Date := StringReplace(Date, '02.', '2.', True, True, False);
Date := StringReplace(Date, '03.', '3.', True, True, False);
Date := StringReplace(Date, '04.', '4.', True, True, False);
Date := StringReplace(Date, '05.', '5.', True, True, False);
Date := StringReplace(Date, '06.', '6.', True, True, False);
Date := StringReplace(Date, '07.', '7.', True, True, False);
Date := StringReplace(Date, '08.', '8.', True, True, False);
Date := StringReplace(Date, '09.', '9.', True, True, False);
AddCustomFieldValueByName('TheMovieDB Updated', Date); // Simple
// AddCustomFieldValueByName('TheMovieDB Updated', DateToStr(CurrentDateTime)); // Simple
// AddCustomFieldValueByName('TheMovieDB Updated', DateToStr(CurrentDateTime) + ' at ' + TimeToStr(CurrentDateTime)); // Verbose
// AddCustomFieldValueByName('TheMovieDB Updated', DateToStr(CurrentDateTime) + + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + SCRIPT_NAME + ' ' + SCRIPT_VERSION); // Annoying
//AddCustomFieldValueByName('TheMovieDB Updated1', Date + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + SCRIPT_NAME + ' ' + SCRIPT_VERSION); // Annoying
AddCustomFieldValueByName('TheMovieDB Updated1', Date + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + RATING_NAME + ' ' + SCRIPT_VERSION); // Annoying
end else
LogMessage('date not found');
//~Released~
curPos := PosFrom('"release_date":"', HTML, EndPos);
if curPos > 0 then begin
curPos := PosFrom('"release_date":"', HTML, EndPos);
endPos := PosFrom('","revenue"', HTML, curPos);
Released := TextBetween(HTML, '"release_date":"', '","revenue"', True, curPos);
//Released := StringReplace(Released, '01', '1', True, True, False);
//Released := StringReplace(Released, '02', '2', True, True, False);
//Released := StringReplace(Released, '03', '3', True, True, False);
//Released := StringReplace(Released, '04', '4', True, True, False);
//Released := StringReplace(Released, '05', '5', True, True, False);
//Released := StringReplace(Released, '06', '6', True, True, False);
//Released := StringReplace(Released, '07', '7', True, True, False);
//Released := StringReplace(Released, '08', '8', True, True, False);
//Released := StringReplace(Released, '09', '9', True, True, False);
if Released <> '' then
begin
ExplodeString(Released, DateParts, '-');
Released := DateParts[2] +'.'+ DateParts[1] +'.'+ DateParts[0];
LogMessage('rdate: '+ Released);
AddFieldValueXML('rdate', Released);
AddCustomFieldValueByName('Release info', Released);
end else
LogMessage('rdate not found');
end;
end;
-
If you change this
//LANG_API_STR = '&language=es'; //WEB_SPECIFIC
LANG_API_STR = '&language=en'; //WEB_SPECIFIC
//LANG_API_STR = '&language=fr'; //WEB_SPECIFIC
and with that part of the code
//Get ~url~
curPos:=Pos('"homepage":"","id":',HTML)+Length('"homepage":"","id":'); //WEB_SPECIFIC
endPos:=PosFrom(',',HTML,curPos); //WEB_SPECIFIC
ItemValue:=Copy(HTML,curPos,endPos - curPos);
if (0=Pos('null',ItemValue)) then begin //WEB_SPECIFIC. But it's impossible not 'homepage'.
ItemValue:=StringReplace(ItemValue,'"','',True,True,False);
ItemValue:=BASE_URL_TRUE+Copy(HTML,curPos,endPos - curPos);
AddFieldValueXML('url',ItemValue);
LogMessage(' Get result url:'+ItemValue+'||');
end;
occur under certain movie to wrong url addresshttp://www.themoviedb.org/movie/ckdrop_path":"/17zArExB7ztm6fjUXZwQWgGMC9f.jpg"
-
CHANGE LOG (21/12/2014):
V 0.2.0.1 VVV: Adjust search list Posters width.
Add a comprobation translated LANG_API_STR overview (Description) (User Option TRASLATED_OVERVIEW)
Add the first ~rdate~ Release Date (Ivek23 proposition)
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)
-
CHANGE LOG (25/12/2014):
V 0.2.0.2 VVV: Fixed bug (search URL) with movies with stored IMDB URL.
Fixed bug with URL get (Ivek23 detected)
Attached the new versión.
Merry Christmas!
(Edito: New version down)
-
CHANGE LOG (25/12/2014):
V 0.2.0.2 VVV: Fixed bug (search URL) with movies with stored IMDB URL.
Fixed bug with URL get (Ivek23 detected)
Attached the new versión.
Thanks.
Merry Christmas!
Same to you.
-
(If some movie fails, please send me the title, the bad information and the search language. Thank you.)
Yes, I found bugs in Search Results:
LANG_STR = '?language=es';
in this movie World Trade Center (http://api.themoviedb.org/3/search/movie?query=+World+Trade+Center+&language=en&include_adult=true&api_key=0a4782bd3877917501a2d45e1198f809) find a cosmetic bug in Search Results:
Problematic is the following piece of code, curPos:=PosFrom('"poster_path":"',HTML,endPos)+Length('"poster_path":"'); //WEB_SPECIFIC
endPos:=PosFrom('"',HTML,curPos); //WEB_SPECIFIC
PreviewURL:='http://image.tmdb.org/t/p/w92'+Copy(HTML,curPos,endPos-curPos); //WEB_SPECIFIC. w92,w185,w300,w342,original.
LogMessage(' Parse Results PreviewURL:'+PreviewURL+'||');
when displaying search results, only three addresses are correct, the fourth, which link does not work, and the fifth title of the copies of the first and second title in search results.
After correcting this part of the codefunction ParsePage(HTML:String;URL:AnsiString):Cardinal;
var
curPos,endPos,NumbResult:Integer;
Title,OriTitle,Year,MovieURL,PreviewURL1,PreviewURL,ItemValue,ItemList,Name,Role,PersonURL:String;
begin
.
.
.
LogMessage(' Parse Results Year:'+Year+'||');
curPos:=PosFrom('"poster_path":',HTML,endPos)+Length('"poster_path":'); //WEB_SPECIFIC
endPos:=PosFrom('"popularity"',HTML,curPos); //WEB_SPECIFIC
PreviewURL1:='http://image.tmdb.org/t/p/w92'+Copy(HTML,curPos,endPos-curPos); //WEB_SPECIFIC. w45,w92,w185,w300,w342,original.
PreviewURL1 := StringReplace(PreviewURL1, '"', '', True, True, False);
PreviewURL1 := StringReplace(PreviewURL1, 'null', '', True, True, False);
PreviewURL:=PreviewURL1; //WEB_SPECIFIC. w45,w92,w185,w300,w342,original.
LogMessage(' Parse Results PreviewURL:'+PreviewURL+'||');
.
.
.
but now the search results with the correct movie titles.
In this movie Blade (http://api.themoviedb.org/3/search/movie?query=+Blade+&language=en&include_adult=true&api_key=0a4782bd3877917501a2d45e1198f809) find a cosmetic bug in Search Results:
Search results the appear with larger the number of movie titles,then occurs several times the same set of movie titles, actually a four times.
//Not Implemented get information of "popularity" "vote_count" "keywords" "images"
"keywords" also means "tags" and the normal Tags field in PVDAddFieldValueXML('tags',ItemValue);
"vote_count" it can be custom TheMoviedb Votes field in PVD.
It may help this one piece of code://~Votes~
curPos := PosFrom('"vote_count":', HTML, EndPos);
if curPos > 0 then begin
curPos := PosFrom('"vote_count":', HTML, EndPos);
endPos := PosFrom(',"alternative_titles"', HTML, curPos);
TmpStr1 := TextBetween(HTML, '"vote_count":', ',"alternative_titles"', True, curPos);
if TmpStr1 = '0' then
TmpStr1 := '';
AddCustomFieldValueByName('TheMoviedb Votes', TmpStr1);
if TmpStr1 = '' then
TmpStr1 := 'vote unknown';
end;
-
CHANGE LOG (27/12/2014):
V 0.2.0.3 VVV: Fixed bug with movie list search URL when the poster is 'null' (Ivek23 detected)
Add the "keywords" as "tags" (Ivek23 proposition)
Add (needs Custom Field ~TheMoviedb_Votes~) "vote_count" (Ivek23 proposition)
Attached the new versión.
(Thanks Ivek23)
(Edito: New version down)
-
The script does not work anymore (search results).
-
CHANGE LOG (08/01/2016):
V 0.2.0.5 VVV: Fixed bug with the "total_results" detection (before it was the last information now "total_pages" is the last).
Adjust to the new order of received informations for "Parsing search Movies"
Eliminate "2014" from name.
Attached the new versión.
(Thanks again Ivek23)
(Edito: New version down)
-
(Thanks again Ivek23)
Thank you for the new version.
-
CHANGE LOG :
V 0.2.0.6 (12/06/2017) VVV:Fixed bug with the order of the search mode.
Attached the new versión.
(Edito: New version down)
-
CHANGE LOG :
V 0.2.0.7 (14/07/2017) VVV:Fixed bug when movies with IMDB URL in PVD.
Attached the new version.
(Edito: New version down)
-
CHANGE LOG :
V 0.2.0.7 (14/07/2017) VVV:Fixed bug when movies with IMDB URL in PVD.
Attached the new version.
Script works properly, thanks.
It looks like the genres does not work.
However, there are errors in the Casablanca (http://www.themoviedb.org/movie/289) movie or Chisum (http://www.themoviedb.org/movie/38765) movie that the url of the director does not appear correctly.
Example for:
Incorrectly
Michael Curtiz
http://www.themoviedb.org/person/redit_id":"52fe4233c3a36847f800b83b"
Correct
Arthur Edeson
http://www.themoviedb.org/person/2005
Or
Incorrectly
Andrew V. McLaglen
http://www.themoviedb.org/person/redit_id":"52fe46dd9251416c9106258d"
-
Thank you, Ivek23 for the alert.
I take the subject and I'll try to solve early ;D
-
CHANGE LOG :
V 0.2.0.8 (27/07/2017) VVV:Eliminated GET_PERSON_INFO_URL option (for KODI better use TheMovieDB People [ES])
Fixed bug with ~genre~ field (the field name is in singular not in plural) and directors url.
Attached the new version.
(Edito: New version down)
-
Attached the new version.
Where is this new version?
-
In the message ... ;D
I just doing a little changes without change the version.
You are very fast Ivek23 ;D
-
In the message ... ;D
I just doing a little changes without change the version.
You are very fast Ivek23 ;D
It was just a coincidence.
-
CHANGE LOG :
V 0.2.0.8 (27/07/2017) VVV:Eliminated GET_PERSON_INFO_URL option (for KODI better use TheMovieDB People [ES])
Fixed bug with ~genre~ field (the field name is in singular not in plural) and directors url.
Attached the new version.
Works great.
-
CHANGELOG (23/09/2017):
V 1.0.0.0 VVV: Completely redone.
New PHOTO_URL_IN_TRANSNAME option to use the Field ~transname~ for storing the URL to the person photo, for send to KODI in a Template.
New ACTORS_LIMIT option (by default = 25) Limit of number of actors retrieved.
Attached the new version.
-
Happily, we have finished the "Beta" phase in the PVD MOD and move on to "Release" state.
So, we closed this topic now and we continue in the new topic:
Personal Video Database 1.0.2.7 MOD
http://www.videodb.info/forum_en/index.php/topic,4134.0.html (http://www.videodb.info/forum_en/index.php/topic,4134.0.html)
See you all there. ;D