2016-09-18 2 views
0

Ich bin mit imacross spielen, um Website-Inhalt zu kratzen, aber ich bin stecken stecken versucht, Bild-URLs von Markdown wie das folgende zu kratzen. wie man imacros zu scrape image url

<div class="dpimages-icons-box"> 
 
    <a href="http://host1.com/1.jpg" class="lightbox" title="9558" rel="dpimages"><img src="//host2.com/9558.jpg" alt="9558" title="9558" width="80" height="54" /></a> 
 
    <a href="http://host1.com/2.jpg" class="lightbox" title="9559" rel="dpimages"><img src="//host2.com/9559.jpg" alt="9559" title="9559" width="80" height="67" /></a> 
 
    <a href="http://host1.com/3.jpg" class="lightbox" title="9560" rel="dpimages"><img src="//host2.com/9560.jpg" alt="9560" title="9560" width="78" height="80" /></a> 
 
    <a href="http://host1.com/4.jpg" class="lightbox" title="9561" rel="dpimages"><img src="//host2.com/9561.jpg" alt="9561" title="9561" width="53" height="80" /></a> 
 
    <a href="http://host1.com/5.jpg" class="lightbox" title="9562" rel="dpimages"><img src="//host2.com/9562.jpg" alt="9562" title="9562" width="52" height="80" /></a> 
 
    <a href="http://host1.com/6.jpg" class="lightbox" title="9562" rel="dpimages"><img src="//host2.com/9562.jpg" alt="9562" title="9562" width="52" height="80" /></a> 
 
    <a href="http://host1.com/7.jpg" class="lightbox" title="9562" rel="dpimages"><img src="//host2.com/9562.jpg" alt="9562" title="9562" width="52" height="80" /></a> 
 
    <div class="clearing"></div> 
 
    </div>

Wie kann ich extrahieren Sie die URLs der ersten n Bilder wie:

http://host1.com/1.jpg 
http://host1.com/2.jpg 
http://host1.com/3.jpg 
http://host1.com/4.jpg 
http://host1.com/5.jpg 

mit imacros und zu einer .csv-Datei speichern?

+0

Bitte den Code Ihrer aktuellen Versuch umfassen. –

+0

ich war verwenden 'TAG POS = 1 TYPE = DIV ATTR = KLASSE: dpimages-icons-box EXTRACT = HTM SPEICHERTYPE = EXTRACT FOLDER = D: \ Scrape \ FILE = pic.csv' zu extrahieren genaue hml-Tag, die benötigen zusätzliche Arbeit, um den Code zu reinigen –

+0

Formatierung von Sprache und Quellcode. –

Antwort

0

Versuchen Sie das folgende Makro anwenden:

SET !EXTRACT_TEST_POPUP NO 
TAG POS=1 TYPE=A ATTR=CLASS:lightbox&&REL:dpimages EXTRACT=HREF 
TAG POS=2 TYPE=A ATTR=CLASS:lightbox&&REL:dpimages EXTRACT=HREF 
TAG POS=3 TYPE=A ATTR=CLASS:lightbox&&REL:dpimages EXTRACT=HREF 
TAG POS=4 TYPE=A ATTR=CLASS:lightbox&&REL:dpimages EXTRACT=HREF 
TAG POS=5 TYPE=A ATTR=CLASS:lightbox&&REL:dpimages EXTRACT=HREF 
SAVEAS TYPE=EXTRACT FOLDER=D:\Scrape\ FILE=pic.csv