English > Scripts and Templates
Script: TheMovieDB [ES] (Easy API Script)
VVV_Easy_Programing:
CHANGE LOG (21/09/2014):
v 0.1.7.1 VVV: Adjust WEB_SPECIFIC to new API.
(Edito: New version down)
Ivek23:
Thanks, script works fine, but find a small cosmetic bug in Actors:
Info in Actors field
--- Quote ---John Wayne ... s Col John Marlowe
William Holden ... s Major 'Hank' Kendall
Constance Towers ... s Miss Hannah Hunter
Judson Pratt ... s Sgt Major Kirby
--- End quote ---
and part of code
--- Code: --- Delete(Role,1,Length(' as ')); //WEB_SPECIFIC
--- End code ---
After correcting this part of the code
--- Code: --- Delete(Role,1,Length(' as ')); //WEB_SPECIFIC
--- End code ---
and the info in Actors field such without cosmetic defects
--- Quote ---John Wayne ... Col John Marlowe
William Holden ... Major 'Hank' Kendall
Constance Towers ... Miss Hannah Hunter
Judson Pratt ... Sgt Major Kirby
--- End quote ---
The correction in this part of the code:
function GetPVDMoviePersonListValue
--- Code: ---//===============================
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;
//===============================
--- End code ---
VVV_Easy_Programing:
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)
Ivek23:
Thanks, script works fine.
If the script open this option,
--- Code: ---LANG_STR = '?language=es';
--- End code ---
but in this movie Little House on the Prairie (1974) find a cosmetic bug in Overview (Description):
Info in Description field
--- Quote ---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>
--- End quote ---
and part of code
--- 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);
--- End code ---
After correcting this part of the code
--- 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;
--- End code ---
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)
If the script open this option
--- Code: ---LANG_STR = '?language=en';
--- End code ---
there these problems, which are described above in this movie Little House on the Prairie (1974), 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.
Ivek23:
Change url address:
from the previous
http://www.themoviedb.org/
to this new url address
https://www.themoviedb.org/
Script does not work anymore.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version