title: Extracting images with scrapy
body: <p>This is my first post on this forum, so apologies if I'm missing anything!</p>
  <p>Basically, I have had some success with the script(seen below), however, it is only returning one image(being the last image on the page).</p>
  <p>Any help is appreciated!</p>
  <pre><code>import scrapy
  
  class KwikEKartSpider(scrapy.Spider):
      name = &quot;kek&quot;
      allowed_domains = [&quot;https://www.tesco.com/groceries/en-GB/shop/fresh-food/all&quot;]
      start_urls = (
          'https://www.tesco.com/groceries/en-GB/shop/fresh-food/all',
      )
  
  def parse(self, response):
      links = response.xpath(&quot;//img/@src&quot;)
      html = &quot;&quot;
      
      for link in links:
          url = link.get()
      
      if any(extension in url for extension in
      [&quot;.jpg&quot;, &quot;.png&quot;]):
          html += &quot;&quot;&quot;&lt;a href=&quot;{url}&quot;
          target=&quot;_blank&quot;&gt;
          &lt;img src=&quot;{url}&quot; height=&quot;33%&quot;
          width=&quot;33%&quot;/&gt;
          &lt;a/&gt;&quot;&quot;&quot;.format(url=url)
  
      with open(&quot;frontpage.html&quot;, &quot;a&quot;) as page:
          page.write(html)
          page.close()
  </code></pre>