Page 3 of 9
Posted: 2017-12-26 09:48:38
by kalimagdora
Thanks, a lot for helping 799 line Radagast,
now the pictures import is working!!!
THX herman
but now the original title doesn't work
Radagast wrote:herman wrote:for poster to work just update one line in ImportLargePicture function:
Value := TextBetween(PageText, 'alt="Poster"', '/>');
and it gonna to work. They still change something.
It works for me herman, thanks.
Line to update in the script it's number 799
original title not working
Posted: 2017-12-26 10:46:16
by oobaka
It isn't working for me either.
Tried imdb for 10 000 BC and the original title changes to "Find industry contacts & talent representationManage your photos, credits, & moreShowcase yourself on IMDb & AmazonGo to IMDbPro"
Changed line 799 to the new value as well...that's no longer working either
Posted: 2017-12-26 11:39:20
by herman
original title and year didnt worked for some movies, so for original title i changed the whole section by this and now works:
// OriginalTitle & Year
if CanSetField(fieldOriginalTitle) or CanSetField(fieldYear) then
begin
originalTitle := TextBefore(PageText, '(original title)', '</h3>');
if originalTitle ='' then originalTitle := TextBetween (PageText,'<h3 itemprop="name">','<span class="titlereference-title-year">');
Value:= TextBetween (Pagetext, '<span class="titlereference-title-year">', '<ul class="ipl-inline-list">');
Value:= TextBetween (Value, 'url', '</a>)');
Value:= TextAfter (Value, '>');
HTMLRemoveTags(originalTitle);
HTMLDecode(originalTitle);
originalTitle := RemoveSpaces(originalTitle, true);
if (originalTitle <> '') and CanSetField(fieldOriginalTitle) then
SetField(fieldOriginalTitle, FullTrim(originalTitle));
end;
if CanSetField(fieldYear) then SetField(fieldYear, Value);
I also found that it doesnt import poster for some movies so i had to change line 806 with this and now it works for all movies i tested:
Value := TextBefore(Value, '._', '') + '._V1_SY' + LargePictureHeight + '_AL_.jpg';
Posted: 2017-12-26 13:10:26
by kalimagdora
Original Tittle - need to be replaced from line178 to 219?
herman wrote:original title and year didnt worked for some movies, so for original title i changed the whole section by this and now works:
// OriginalTitle & Year
if CanSetField(fieldOriginalTitle) or CanSetField(fieldYear) then
begin
originalTitle := TextBefore(PageText, '(original title)', '</h3>');
if originalTitle ='' then originalTitle := TextBetween (PageText,'<h3 itemprop="name">','<span class="titlereference-title-year">');
Value:= TextBetween (Pagetext, '<span class="titlereference-title-year">', '<ul class="ipl-inline-list">');
Value:= TextBetween (Value, 'url', '</a>)');
Value:= TextAfter (Value, '>');
HTMLRemoveTags(originalTitle);
HTMLDecode(originalTitle);
originalTitle := RemoveSpaces(originalTitle, true);
if (originalTitle <> '') and CanSetField(fieldOriginalTitle) then
SetField(fieldOriginalTitle, FullTrim(originalTitle));
end;
if CanSetField(fieldYear) then SetField(fieldYear, Value);
I also found that it doesnt import poster for some movies so i had to change line 806 with this and now it works for all movies i tested:
Value := TextBefore(Value, '._', '') + '._V1_SY' + LargePictureHeight + '_AL_.jpg';
Posted: 2017-12-26 13:41:06
by antp
herman wrote:original title and year didnt worked for some movies, so for original title i changed the whole section by this and now works:
Thanks, I'm including these changes, as well as the fix for user comments.
I'll see if I can do something for translated titles now (but as it works fine for me it is difficult to be sure that the problem is solved for others
)
Posted: 2017-12-26 13:53:55
by antp
So I've published as version 4.003 the fixes mentioned above.
I've also changes constants to script parameters, so the UserCountry, MaxActors and LargePictureHeight values can be defined via the parameters, below the options, on the right of the script window, and shouldn't be lost each time the script is updated.
If there are still problems with the translated titles, please provide the URL of the movie page as well as the country set as "UserCountry".
I could not reproduce the problem mentioned for "La espada del dragón" previously
antp, you're a god
Posted: 2017-12-26 14:23:28
by oobaka
antp, you're a god
Thanks a million.
awards
Posted: 2017-12-26 16:09:56
by herman
For anybody who is interested I updated awards section, for some movies it didnt imported correctly and i didnt liked layout
[code]
// Import awards
procedure ImportAwards;
var
IndexPage: TStringList;
PageText, FullValue, Block, Value, Row, Outcome, Details, AwardShow, PageText1, Person, PersonRow: string;
Year, Result, Award, Category: string;
pp, p: integer;
begin
sleep(50);
Value := MovieUrl;
PageText := ConvertToASCII(GetPage(Value+'/awards'));
repeat
AwardShow := TextBetween(PageText, '<h3>', '</h3>');
p:=0;
if Pos('User Lists', AwardShow) > 0 then
break;
HTMLRemoveTags(AwardShow);
HTMLDecode(AwardShow);
AwardShow := FullTrim(AwardShow);
AwardShow := StringReplace(AwardShow, #13, '');
AwardShow := StringReplace(AwardShow, #10, '');
If (fullvalue<>'') and (awardshow <>'') then
FullValue := FullValue + #13#10 + #13#10 + AwardShow + #13#10 else
FullValue := FullValue + AwardShow + #13#10;
PageText1 := TextBetween(PageText, '<table class="awards"', '</table>');
PageText := RemainingText;
Block := PageText1;
repeat
Row := TextBetween(Block, '<tr>', '</tr>');
Block := RemainingText;
p:=p+1;
Outcome := TextBetween(Row, '<b>', '</b>');
Category := TextBetween(Row, '<span class="award_category">', '</span>');
Award := TextBetween(Row, '<td class="award_description">', '</td>');
Person:= TextBetween(Row, 'ref_=ttawd_', '</a>');
Details := TextBetween(Row, '<div class="award_detail_notes">', '</div>');
If Outcome <> '' then
if p<2 then
FullValue := FullValue + Outcome + #13#10
else
FullValue := FullValue + #13#10 + Outcome + #13#10;
If Category <> '' then
FullValue := FullValue + Category + ' : ';
If Award <> '' then begin
if pos ('<a href', Award) > 0 then
begin
Award := TextBefore (Award, '<a href', '');
Award := RemoveSpaces(Award, true);
end
else
Award := TextBefore (Award, '<', '');
HTMLRemoveTags(Award);
HTMLDecode(Award);
Award := StringReplace(Award, #13, '');
Award := StringReplace(Award, #10, '');
Award := FullTrim(Award);
Award := StringReplace(Award, ' ', '');
if (outcome='') and (category = '') then
FullValue := FullValue + ' # ' + Award
else
FullValue := FullValue + Award;
end;
PersonRow:= TextBetween(Row, 'ref_=ttawd_', '</td>');
if pos ('<div class="award_detail_notes">', PersonRow) > 0 then PersonRow:= TextBefore(PersonRow, '<div class="award_detail_notes">','');
pp:=0;
repeat
If Person <> '' then begin
pp:= pp + 1;
if pos ('<a href', PersonRow) > 0 then
begin
Person := TextBetween (PersonRow, '>', '<a href');
Person := RemoveSpaces(Person, true);
Person := StringReplace(Person, ' ,', '');
end
else
Person:= TextBetween (PersonRow, '>', '</a>' );
HTMLRemoveTags(Person);
HTMLDecode(Person);
Person:= FullTrim(Person);
if award <> '' then
if pp = 1 then
FullValue := FullValue + ' - ' + Person
else
FullValue := FullValue + ', ' + Person
else
if pp = 1 then
FullValue := FullValue + Person
else
FullValue := FullValue + ', ' + Person;
FullValue := StringReplace(FullValue, 'For, ', 'For ');
FullValue := StringReplace(FullValue, 'and, ', 'and ');
PersonRow:= RemainingText;
PersonRow:= TextAfter(PersonRow, 'ref_=ttawd_');
end;
until (PersonRow ='');
If Details <> '' then begin
if pos ('truncated-note', Details) > 0 then
Details:= TextBetween (Details, '<p class="full-note">', '</p>');
HTMLRemoveTags(Details);
HTMLDecode(Details);
Details := StringReplace(Details, #13, '');
Details := StringReplace(Details, #10, '');
Details := FullTrim(Details);
FullValue := FullValue + #32 + '(' + Details + ')'
end
until (Row = '');
until (PageText1 = '');
// ShowInformation(FullValue);
[/code]
description
Posted: 2017-12-26 16:29:21
by herman
I dont know why but some movies missing plot summary down on the main page, so i updated the code to take the longest summary from plotsummary subscreen:
[code]
// Description
if CanSetField(fieldDescription) then
begin
if (GetOption('DescriptionSelection') = 0) then
begin
Value := TextBetween(PageText, '<span class="ipl-rating-star__rating">Rate</span>', '<div class="titlereference-overview-section">');
Value := TextAfter(Value, '<hr>');
end
else
begin
Value2:='';
FullValue := ConvertToASCII(GetPage(MovieURL+'/plotsummary'));
FullValue := TextBetween(FullValue, '<h4 id="summaries" class="ipl-list-title">Summaries</h4>','</ul>');
Value:= TextBetween (FullValue, '<p>','</p>');
HTMLDecode(Value);
while value<>'' do
begin
if length(value)> length(value2)then value2:=value;
fullvalue:= remainingtext;
Value:= TextBetween (FullValue, '<p>','</p>');
HTMLDecode(Value);
end;
if Pos('<em', Value2) > 0 then
begin
Value2 := TextBefore(Value, '<em', '');
end;
end;
SetField(fieldDescription, Value2);
end;
[/code]
Re: description
Posted: 2017-12-26 17:56:37
by kalimagdora
That's very good thx
herman wrote:I dont know why but some movies missing plot summary down on the main page, so i updated the code to take the longest summary from plotsummary subscreen:
Code: Select all
// Description
if CanSetField(fieldDescription) then
begin
if (GetOption('DescriptionSelection') = 0) then
begin
Value := TextBetween(PageText, '<span class="ipl-rating-star__rating">Rate</span>', '<div class="titlereference-overview-section">');
Value := TextAfter(Value, '<hr>');
end
else
begin
Value2:='';
FullValue := ConvertToASCII(GetPage(MovieURL+'/plotsummary'));
FullValue := TextBetween(FullValue, '<h4 id="summaries" class="ipl-list-title">Summaries</h4>','</ul>');
Value:= TextBetween (FullValue, '<p>','</p>');
HTMLDecode(Value);
while value<>'' do
begin
if length(value)> length(value2)then value2:=value;
fullvalue:= remainingtext;
Value:= TextBetween (FullValue, '<p>','</p>');
HTMLDecode(Value);
end;
if Pos('<em', Value2) > 0 then
begin
Value2 := TextBefore(Value, '<em', '');
end;
end;
SetField(fieldDescription, Value2);
end;
Posted: 2017-12-26 20:19:26
by boristhecat
I've tried every option in Imagekind, with the latest script and the one before it and it throws a 404 not found error every time.
This is with the IMDb.ifs script.
Posted: 2017-12-26 20:26:57
by spikulev
Here I get an error:
Code: Select all
Script error in "IMDB": unknown identifier: MAXACTORS at line 290
and nothing is imported :-(
Please help!
Re: description
Posted: 2017-12-26 21:18:51
by antp
herman wrote:I dont know why but some movies missing plot summary down on the main page, so i updated the code to take the longest summary from plotsummary subscreen:
The idea of taking it from the main page is to make import faster, so it should be taken from the other page only if not found. There was previously an option to take either the longest summary, or show a list of available summaries ; that was the function ImportSummary, currently not used, but that could be used again if updated to parse correctly the plut summary page.
spikulev wrote:Here I get an error:
Code: Select all
Script error in "IMDB": unknown identifier: MAXACTORS at line 290
My bad, it seems that I missed something there, I changed only for one of the ActorsLayout options and not the other.
boristhecat wrote:I've tried every option in Imagekind, with the latest script and the one before it and it throws a 404 not found error every time.
This is with the IMDb.ifs script.
There seems to be a bug with parameters, instead of taking their default values they are empty by default, I've modified the script so it sets the default value if it is empty.
=> version 4.004 that should fix these
(if you still get the image error, be sure that there is a valid number for the parameter "LargePictureHeight", on the right of the window, under the options)
Posted: 2017-12-26 21:45:28
by spikulev
Thanx a lot. My problem is fixed now.
Posted: 2017-12-28 01:36:51
by Radagast
With v4.004 of the script all things seems to work fine, include the translated title.
Thanks Antoine and Herman
Re: description
Posted: 2017-12-28 08:17:29
by kalimagdora
Thanks Antoine and Herman !!!!!
everything works
producers
Posted: 2017-12-28 17:14:05
by herman
for those who are interested i added to producers names their "producers role" so it will looks like:
Brent Baum (producer), Michael Baumgarten (line producer), Des Carey (executive producer), Aaron Judkins (associate producer), Matthew Marsden (producer), Patrick Millsaps (executive producer), Joe Reed (associate producer)
[code]
// Producer
if CanSetField(fieldProducer) then
begin
Value := TextBetween(PageText, '<h4 name="producers"', '</table>');
FullValue := '';
Value2 := TextBetween(Value, '<a href="/name/', '</a>');
Value3 := TextBetween(Value, '<td>', '</tr>');
while Value2 <> '' do
begin
Value := RemainingText;
Value2 := TextAfter(Value2, '>');
Value3 := ' (' + TextBetween (Value3, '<td>','</td>') + ')';
if FullValue <> '' then
FullValue := FullValue + ', ';
HTMLRemoveTags(Value2);
FullValue := FullValue + RemoveSpaces(Value2, true)+ Value3;
Value2 := TextBetween(Value, '<a href="/name/', '</a>');
Value3 := TextBetween(Value, '<td>', '</tr>');
end;
HTMLDecode(FullValue);
SetField(fieldProducer, FullValue);
end;
[/code]
writers
Posted: 2017-12-28 17:19:15
by herman
For those who are interested i added to writers their "writers role". So it will looks like:
Bill Svanoe (story), Hilary Henkin (screenplay), Dean Riesner (written by)
[code]
// Writer
if CanSetField(fieldWriter) then
begin
Value := TextBetween(PageText, '<table class="subpage_data spFirst writers_list">', '</table>');
FullValue := '';
Value3:= TextBetween(Value, '<td class="name">', '</td>');
if pos ('a href', Value3)> 0 then
begin
Value3:= TextAfter(Value, '<td>...</td>');
Value3:= TextBetween(Value3,'<td>','</td>');
Value3 := StringReplace (Value3, ' &','');
end;
Value3:= Removespaces(Value3, True);
if (Value3 <>'') then
if (pos ('(', Value3) = 0) then Value3:= ' (' + Value3 + ')'
else Value3:= ' ' + Value3;
Value2 := TextBetween(Value, '<a href="/name/', '</tr>');
while Value2 <> '' do
begin
Value := RemainingText;
while value2 <> '' do begin
if pos ('<a href="/name/', Value2) > 0 then
begin
Value4 := TextBetween(Value2, '>','<a' );
end
else
Value4 := TextBetween(Value2, '>', '</td>');
if FullValue <> '' then
FullValue := FullValue + ', ';
HTMLRemoveTags(Value4);
Value4 := StringReplace (Value4, ' &','');
Value4 := StringReplace (Value4, 'nbsp;and','');
FullValue := FullValue + RemoveSpaces(Value4, true) + Value3;
Value2 := RemainingText;
Value2 := TextAfter(Value2, 'href="/name/');
end;
Value3:= TextBetween(Value, '<td class="name">', '</td>');
if pos ('a href', Value3)> 0 then
begin
Value3:= TextAfter(Value, '<td>...</td>');
Value3:= TextBetween(Value3,'<td>','</td>');
Value3 := StringReplace (Value3, ' &','');
end;
Value3:= Removespaces(Value3, True);
if (Value3 <>'') then
if (pos ('(', Value3) = 0) then Value3:= ' (' + Value3 + ')'
else Value3:= ' ' + Value3;
Value2 := TextBetween(Value, '<a href="/name/', '</tr>');
end;
HTMLDecode(FullValue);
SetField(fieldWriter, FullValue);
end;
[/code]
Just add new used variables to procedure and enjoy.
Posted: 2017-12-28 22:05:51
by Radagast
Producers role and Writers role not work for me herman, both give me the same error
Script error on "IMDB": unknown identifier: VALUE3 on the line 437
the number of the line it's different but the error it's the same.
Most sure I'm doing something wrong
Posted: 2017-12-28 22:24:39
by Radagast
I correct myself Herman, after read again your last message I understand that need to modify another line to activate the new variables Value3 and Value4.
Now work fine, thanks.
For those ones that give same error than me the line needed to modify it's the 140, should be like this
Code: Select all
Value, Value2, Value3, Value4, FullValue, originalTitle: string;