How to download pictures in embedded javascript???

Discuss how to download pictures from websites using PicaLoader.
(NO adult contents and advertisement please.)
Post Reply
merc_slk
Posts: 17
Joined: Sat Jan 26, 2008 4:34 pm

How to download pictures in embedded javascript???

Post by merc_slk »

Hello,

I want to download the large pictures from http://www.cazar.de
But al those are embedded in a javascript called zoomwin, see example :

function zoomWin(Title,Poster)
{
myWin = window.open("", "", "width=0,height=0,scrollbars");
myWin.moveTo(0,0);
myWin.resizeTo(screen.availWidth,screen.availHeight);
myWin.document.writeln("<html>");
myWin.document.writeln("<title>CAZAR</title>");
myWin.document.writeln("<head>");
myWin.document.writeln("</head>");
myWin.document.writeln("<body bgcolor='#000000'>");
myWin.document.writeln("<center>");
myWin.document.writeln("<a href='javascript:self.close()'><font size='+1' color='#FFFFFF' face='Verdana'>Fenster schliessen</font></a><br>");
myWin.document.writeln("<br>");
myWin.document.writeln("<table cellspacing=0 cellpadding=0 border=0><td align=center width=300 height=50>");
myWin.document.writeln("<a href='javascript:self.close()'><img src=\"" + Poster + "\" hspace=0 vspace=0 border=0></a>");
myWin.document.writeln("<br><font size='+1' color='#FFFFFF' face='Verdana'>" + Title + "</font><br><font size='-1' color='#FFFFFF' face='Verdana'>© Copyright CAZAR.DE</font>");
myWin.document.writeln("</td></table>");
myWin.document.writeln("</center>");
myWin.document.writeln("</body>");
myWin.document.writeln("</html>");
myWin.focus();
}

The function is called like this :

<a href="javascript:zoomWin('Andres Sarda - Nice - BH','http://www.cazar.de/shop/out/oxbaseshop/html/0/dyn_images/d_37_andressarda/im_NICESEPE.jpg')" class="producthead">

So I want to crawl this website and download only the pictures referred in this javascript.

Can anybody help me?? Tx

Jef
User avatar
KoalaBear
Posts: 325
Joined: Wed Sep 24, 2003 5:27 pm

Post by KoalaBear »

PicaLoader can deal with JavaScript on many site by it default HTML Parser, but not all.
But now, PicaLoader 1.60 released, it have a new powerful feature: you can customize HTML Parser by Lua script!
So, for this site, you can create a new task:
Start URL:http://www.cazar.de/
Uncheck Support J/VB/JavaScript
Page URL Include Filters:/shop/index\.php
Page URL Exclude Filters:lang=1;cl=newsletter;cl=contact;cl=account;cl=basket;cl=suggest
Picture URL Include Filters:/im_
HTML Parser Script:

if string.find(HTML.Url,"cl=details",1,true) then
for pic in string.gmatch(HTML.Content,'javascript:zoomWin%b()') do
local ts,te=string.find(pic,"%b''");
local us,ue=string.find(pic,"%b''",te+1);
local title=string.sub(pic,ts+1,te-1);
local url=string.sub(pic,us+1,ue-1);
AddLink(url,HTML.Url,title,'',HTML.TaskID,HTML.Level);
end;
end;
DefaultParser(HTML.Content,HTML.Url,HTML.Title,HTML.TaskID,HTML.Level);

Other settings keep the default.
Attachments
de.jpg
de.jpg (112 KiB) Viewed 746 times
de2.jpg
de2.jpg (77.6 KiB) Viewed 746 times
User avatar
KoalaBear
Posts: 325
Joined: Wed Sep 24, 2003 5:27 pm

Post by KoalaBear »

PicaLoader 1.61 released, and it have a new feature: Export and Import task setting. now we can share task setting easily.

You can download the attached .plt file and save to your hard disk, then run PicaLoader, open a project, select main menu->Task->Import Tasks, select the plt file that you just saved to hard disk.
Attachments
cazar.plt
download to your hard disk, then select main menu-&gt;Task-&gt;Import Tasks.
(9.93 KiB) Downloaded 54 times
User avatar
Jaalpari
Posts: 47
Joined: Tue Feb 12, 2008 9:14 am

Post by Jaalpari »

thanks 4 the project
merc_slk
Posts: 17
Joined: Sat Jan 26, 2008 4:34 pm

Just what I need

Post by merc_slk »

Wow great, I just does what it needs to do. Great.
wforecast
Posts: 4
Joined: Wed Dec 28, 2005 1:06 am

does not work with me

Post by wforecast »

does not work with me :cry: finish task without downloading any picz

but nancy.plt works fine :D

why?

parser script is great tool but i don't know how to use :oops:

C U~
Post Reply