<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Prabhas</title>
    <description>The latest articles on DEV Community by Prabhas (@prabhas99).</description>
    <link>https://dev.to/prabhas99</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3218108%2F71bcb9d0-975b-4454-956f-fa9531ee84e9.png</url>
      <title>DEV Community: Prabhas</title>
      <link>https://dev.to/prabhas99</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prabhas99"/>
    <language>en</language>
    <item>
      <title>How to scrape all images using curl method</title>
      <dc:creator>Prabhas</dc:creator>
      <pubDate>Wed, 28 May 2025 14:17:42 +0000</pubDate>
      <link>https://dev.to/prabhas99/how-to-scrape-all-images-using-curl-method-5543</link>
      <guid>https://dev.to/prabhas99/how-to-scrape-all-images-using-curl-method-5543</guid>
      <description>&lt;p&gt;To scrape &lt;strong&gt;all images from a single page&lt;/strong&gt; using &lt;strong&gt;&lt;code&gt;curl&lt;/code&gt; only&lt;/strong&gt;, you're limited to sites(&lt;a href="https://memes-apk.com" rel="noopener noreferrer"&gt;Memes apk&lt;/a&gt;) where images are directly embedded in the HTML (not loaded via JavaScript). Here's a &lt;strong&gt;step-by-step guide&lt;/strong&gt; using only &lt;code&gt;curl&lt;/code&gt; and basic Unix tools:&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ &lt;strong&gt;Step-by-Step: Scraping Images Using &lt;code&gt;curl&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🧰 Requirements:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;curl&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;sed&lt;/code&gt;, or &lt;code&gt;awk&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wget&lt;/code&gt; or another method to download the images&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🔹 Step 1: Download the HTML
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; https://memes-apk.com &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; page.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-L&lt;/code&gt; follows redirects.&lt;/li&gt;
&lt;li&gt;Save the page to a file.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🔹 Step 2: Extract Image URLs
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-Eo&lt;/span&gt; &lt;span class="s1"&gt;'https://[^"]+\.(jpg|jpeg|png|gif)'&lt;/span&gt; page.html &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; image-urls.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This command looks for &lt;code&gt;https://...&lt;/code&gt; URLs ending in image extensions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also refine it if the images are relative paths:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-Eo&lt;/span&gt; &lt;span class="s1"&gt;'src="[^"]+\.(jpg|jpeg|png|gif)"'&lt;/span&gt; page.html | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="s1"&gt;'s/src="//;s/"$//'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; image-urls.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If the URLs are relative (like &lt;code&gt;/images/meme.png&lt;/code&gt;), prepend the domain:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s|^/|https://memes-apk.com/|'&lt;/span&gt; image-urls.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🔹 Step 3: Download the Images
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wget &lt;span class="nt"&gt;-i&lt;/span&gt; image-urls.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This downloads all the images from the list.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ One-liner (Optional)
&lt;/h2&gt;

&lt;p&gt;If you want it done in a single line (for simpler sites):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; https://memes-apk.com | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-Eo&lt;/span&gt; &lt;span class="s1"&gt;'https://[^"]+\.(jpg|jpeg|png|gif)'&lt;/span&gt; | xargs &lt;span class="nt"&gt;-n&lt;/span&gt; 1 wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ⚠️ Limitations of &lt;code&gt;curl&lt;/code&gt;:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It &lt;strong&gt;does not run JavaScript&lt;/strong&gt;, so you won’t get images loaded dynamically.&lt;/li&gt;
&lt;li&gt;It &lt;strong&gt;does not crawl&lt;/strong&gt; multiple pages — just the one you provide.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ Bonus: Download All Images Recursively (Not Just &lt;code&gt;curl&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;If you want to crawl multiple pages &lt;strong&gt;recursively&lt;/strong&gt;, use &lt;code&gt;wget&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wget &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="nt"&gt;-l2&lt;/span&gt; &lt;span class="nt"&gt;-nd&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; jpg,jpeg,png,gif &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;robots&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;off https://memes-apk.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Do you want help writing a shell script that does this automatically for all pages or categories?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
