amazon.sco
Posted: Sat Apr 06, 2019 10:55 pm
has anybody ever tried to make an amazon.sco similar to the amg.sco? there are just some things that allmusic doesn't have... that amazon does...
http://www.jtclipper.eu/godfatherforums/
http://www.jtclipper.eu/godfatherforums/viewtopic.php?f=3&t=858
Code: Select all
{https://www.amazon.com}
{?
TITLE=FORM;field-keywords=%:str
ALBUM=FORM;field-keywords=%:str
ARTIST=FORM;field-keywords=%:str
/?}
Program Allmusic;
const LIST_SEP = ',';
var
slMain: TStringList;
iPos,iRow: integer;
sTmp: String;
//---
procedure GetImage;
var
iPos: integer;
sLine: string;
begin
if on_FindRow( iRow, 0, '"digitalMusicProductImage_feature_div"', slMain ) or
on_FindRow( iRow, 0, '<div class="imgTagWrapper"', slMain ) then begin
if on_FindRow( iRow, 0, 'alt="', slMain ) then begin
sLine := slMain.Strings[ iRow ];
iPos := Pos( 'src="', sLine );
if iPos > 0 then begin
sTmp := Copy( sLine, iPos + 5, 99999 );
iPos := Pos( '"', sTmp );
if iPos > 0 then begin
sTmp := Copy( sTmp, 1, iPos -1 );
on_setPicture( sTmp );
end;
end;
end;
end;
iRow := 0;
end;
//---
function GetListing: string;
begin
result := Trim( on_cleanHTMLLine( AnsiReplaceText( slMain[ iRow ], '</a>', '</a>' + LIST_SEP ) ) );
while Pos( ' ', result ) > 0 do result := AnsiReplaceText( result, ' ', ' ' );
result := AnsiReplaceText( result, LIST_SEP + ' ', LIST_SEP );
if Copy( result, Length( result ), 1 ) = LIST_SEP then result := Copy( result, 1, Length( result ) - 1 );
end;
//---
procedure GetTracks;
var
sID, sTrack, sComposer, sPerformer, sTitle, sTime: string;
iTrack: integer;
begin
iTrack := 0;
while on_FindRow( iRow, 0, '/ref=dm_ws_tlw_trk', slMain ) do begin
//same track ?
if Pos( '/ref=dm_ws_tlw_trk' + IntToStr( iTrack ), slMain[ iRow ] ) = 0 then begin
sID := Copy( slMain[ iRow ], Pos( 'href="/dp/', slMain[ iRow ] ) + 10, 999 );
sID := Copy( sID, 1, Pos( '/ref=dm_ws_tlw_trk', sID ) - 1 ) ;
Inc( iTrack );
sTrack := IntToStr( iTrack );
sTitle := on_cleanHTMLLine( slMain[ iRow ] );
//Track artist?
if on_FindRow( iRow, 0, '/ref=dm_ws_tlw_art' + sTrack + '"', slMain ) then begin
sPerformer := on_cleanHTMLLine( slMain[ iRow ] );
end;
//Duration
if on_FindRow( iRow, 0, '"dmusic_tracklist_duration_' + sID + '"', slMain ) then begin
sTime := slMain[ iRow + 3 ];
end;
if on_getIsVarious and (sPerformer <> '') then sTitle := sPerformer + ' / ' + sTitle;
on_addTrack( sTrack, sTitle, sComposer, sTime );
end;
Inc(iRow);
end;
end;
//---
// procedure GetReview;
// begin
// on_setComment( on_cleanHTMLMultiLine( slMain[ iRow + 2 ] ) );
// end;
begin
on_Init(1); // comment this out if you wish to retain current values
slMain := TStringList.Create;
try
iRow := 0;
on_loadHTML( slMain ); // load the actual page to a stringlist
//slMain.SaveToFile( 'c:\1.htm' ); //uncomment if you want to see the HTML code
// image if any
GetImage;
// album
if on_FindRow( iRow, 0, '"dmusicProductTitle_feature_div"', slMain) then begin
if on_FindRow( iRow, 0, '<h1 class="', slMain) then begin
on_setAlbum( on_cleanHTMLLine( slMain[ iRow ] ) );
end;
iRow := 0;
end;
//artist
if on_FindRow( iRow, 0, '"ProductInfoArtistLink"', slMain) then begin
sTmp := on_cleanHTMLLine( slMain[ iRow ] );
//if Copy( sTmp, 0, 4) = 'The ' then sTmp := Copy( sTmp, 5, 9999 ); // uncomment to get rid of THE <artist name>
on_setArtist ( sTmp );
if on_getIsVarious then on_setAlbumArtist ( sTmp );
iRow := 0;
end;
//year
if on_FindRow( iRow, 0, '"ProductInfoReleaseDate"', slMain) then begin
on_setYear( on_cleanHTMLLine( slMain[ iRow+1 ] ) );
iRow := 0;
end;
//label
if on_FindRow( iRow, 0, '<strong>Label:</strong>', slMain) then begin
sTmp := on_cleanHTMLLine( slMain[ iRow ] );
on_setLabel( Copy( sTmp, 8, 9999 ) );
iRow := 0;
end;
//genre
if on_FindRow( iRow, 0, '<strong>Genres:</strong>', slMain) then begin
if on_FindRow( iRow, 0, '<li><a href="', slMain) then begin
sTmp := GetListing;
iPos := Pos( ',', sTmp );
if iPos > 0 then begin
on_setGenre( Copy( sTmp, 1, iPos -1 ) );
on_setStyles( sTmp );
end else begin
on_setGenre( sTmp );
end;
end;
iRow := 0;
end;
//type
if on_FindRow( iRow, 0, '<li><b>Format:</b>', slMain) then begin
sTmp := Trim( Copy( GetListing, 8, 999 ) );
on_setType( sTmp );
iRow:=0;
end;
// Tracks
if on_FindRow( iRow, 0, '"dmusic_tracklist_header_default_message"', slMain ) then begin
GetTracks;
iRow:=0;
end;
//Review
//if on_FindRow( iRow, 0, '?????"', slMain ) then GetReview;
finally
slMain.Free;
sys_SetStatusText( 0, 'Done' );
end;
end.
Code: Select all
KEY = HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
VALUE REG_DWORD= TheGodFather.exe
add 11001 as decimal
Code: Select all
{https://www.amazon.com}
{?
TITLE=FORM;field-keywords=%:str
ALBUM=FORM;field-keywords=%:str
ARTIST=FORM;field-keywords=%:str
/?}
Program Allmusic;
const LIST_SEP = ',';
var
slMain: TStringList;
iPos,iRow: integer;
sTmp: String;
//---
procedure GetImage;
var
iPos: integer;
sLine: string;
begin
if on_FindRow( iRow, 0, 'digitalMusicProductImage_feature_div', slMain ) or
on_FindRow( iRow, 0, '<div class="imgTagWrapper"', slMain ) then begin
if on_FindRow( iRow, 0, 'alt="', slMain ) then begin
sLine := slMain.Strings[ iRow ];
iPos := Pos( 'src="', sLine );
if iPos > 0 then begin
sTmp := Copy( sLine, iPos + 5, 99999 );
iPos := Pos( '"', sTmp );
if iPos > 0 then begin
sTmp := Copy( sTmp, 1, iPos -1 );
on_setPicture( sTmp );
end;
end;
end;
end;
iRow := 0;
end;
//---
function GetListing: string;
begin
result := Trim( on_cleanHTMLLine( AnsiReplaceText( slMain[ iRow ], '</a>', '</a>' + LIST_SEP ) ) );
while Pos( ' ', result ) > 0 do result := AnsiReplaceText( result, ' ', ' ' );
result := AnsiReplaceText( result, LIST_SEP + ' ', LIST_SEP );
if Copy( result, Length( result ), 1 ) = LIST_SEP then result := Copy( result, 1, Length( result ) - 1 );
end;
//---
procedure GetTracks;
var
sID, sTrack, sComposer, sPerformer, sTitle, sTime: string;
iTrack: integer;
begin
iTrack := 0;
while on_FindRow( iRow, 0, '/ref=dm_ws_tlw_trk', slMain ) do begin
//same track ?
if Pos( '/ref=dm_ws_tlw_trk' + IntToStr( iTrack ), slMain[ iRow ] ) = 0 then begin
sID := Copy( slMain[ iRow ], Pos( 'href="/dp/', slMain[ iRow ] ) + 10, 999 );
sID := Copy( sID, 1, Pos( '/ref=dm_ws_tlw_trk', sID ) - 1 ) ;
Inc( iTrack );
sTrack := IntToStr( iTrack );
sTitle := on_cleanHTMLLine( slMain[ iRow ] );
//Track artist?
if on_FindRow( iRow, 0, '/ref=dm_ws_tlw_art' + sTrack + '"', slMain ) then begin
sPerformer := on_cleanHTMLLine( slMain[ iRow ] );
end;
//Duration
if on_FindRow( iRow, 0, '"dmusic_tracklist_duration_' + sID + '"', slMain ) then begin
sTime := slMain[ iRow + 3 ];
end;
if on_getIsVarious and (sPerformer <> '') then sTitle := sPerformer + ' / ' + sTitle;
on_addTrack( sTrack, sTitle, sComposer, sTime );
end;
Inc(iRow);
end;
end;
//---
// procedure GetReview;
// begin
// on_setComment( on_cleanHTMLMultiLine( slMain[ iRow + 2 ] ) );
// end;
begin
on_Init(1); // comment this out if you wish to retain current values
slMain := TStringList.Create;
try
iRow := 0;
on_loadHTML( slMain ); // load the actual page to a stringlist
slMain.SaveToFile( 'c:\1.htm' ); //uncomment if you want to see the HTML code
// image if any
GetImage;
// album
if on_FindRow( iRow, 0, 'dmusicProductTitle_feature_div', slMain) then begin
if on_FindRow( iRow, 0, '<h1 class="', slMain) then begin
on_setAlbum( on_cleanHTMLLine( slMain[ iRow ] ) );
end;
iRow := 0;
end;
//artist
if on_FindRow( iRow, 0, 'ProductInfoArtistLink', slMain) then begin
sTmp := on_cleanHTMLLine( slMain[ iRow ] );
//if Copy( sTmp, 0, 4) = 'The ' then sTmp := Copy( sTmp, 5, 9999 ); // uncomment to get rid of THE <artist name>
on_setArtist ( sTmp );
if on_getIsVarious then on_setAlbumArtist ( sTmp );
iRow := 0;
end;
//year
if on_FindRow( iRow, 0, 'ProductInfoReleaseDate', slMain) then begin
on_setYear( on_cleanHTMLLine( slMain[ iRow+1 ] ) );
iRow := 0;
end;
//label
if on_FindRow( iRow, 0, '<strong>Label:</strong>', slMain) then begin
sTmp := on_cleanHTMLLine( slMain[ iRow ] );
on_setLabel( Copy( sTmp, 8, 9999 ) );
iRow := 0;
end;
//genre
if on_FindRow( iRow, 0, '<strong>Genres:</strong>', slMain) then begin
if on_FindRow( iRow, 0, '<li><a href="', slMain) then begin
sTmp := GetListing;
iPos := Pos( ',', sTmp );
if iPos > 0 then begin
on_setGenre( Copy( sTmp, 1, iPos -1 ) );
on_setStyles( sTmp );
end else begin
on_setGenre( sTmp );
end;
end;
iRow := 0;
end;
//type
if on_FindRow( iRow, 0, '<li><b>Format:</b>', slMain) then begin
sTmp := Trim( Copy( GetListing, 8, 999 ) );
on_setType( sTmp );
iRow:=0;
end;
// Tracks
if on_FindRow( iRow, 0, 'dmusic_tracklist_header_default_message', slMain ) then begin
GetTracks;
iRow:=0;
end;
//Review
//if on_FindRow( iRow, 0, '?????"', slMain ) then GetReview;
finally
slMain.Free;
sys_SetStatusText( 0, 'Done' );
end;
end.