<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Prasetyo Singgih on Medium]]></title>
        <description><![CDATA[Stories by Prasetyo Singgih on Medium]]></description>
        <link>https://medium.com/@psinggihl?source=rss-a0fbeff2c52b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vENABzg-bWZ-MNf6.jpg</url>
            <title>Stories by Prasetyo Singgih on Medium</title>
            <link>https://medium.com/@psinggihl?source=rss-a0fbeff2c52b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 23:37:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@psinggihl/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Scraping price list gadget in online store using Python with Beautiful Soup]]></title>
            <link>https://medium.com/@psinggihl/scraping-price-list-gadget-in-online-store-using-python-with-beautiful-soup-a1218cf1256d?source=rss-a0fbeff2c52b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1218cf1256d</guid>
            <category><![CDATA[beautifulsoup]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[urllib]]></category>
            <dc:creator><![CDATA[Prasetyo Singgih]]></dc:creator>
            <pubDate>Fri, 08 Mar 2019 09:24:21 GMT</pubDate>
            <atom:updated>2019-03-08T09:34:47.508Z</atom:updated>
            <content:encoded><![CDATA[<p>I am going to write the simplest web scraper in Python to scraping price list gadget in online store with the help of libraries like <a href="http://docs.python-requests.org/en/master/"><strong>requests</strong></a> and <a href="https://www.crummy.com/software/BeautifulSoup/"><strong>BeautifulSoup</strong></a>.</p><h3>What is Web scraping?</h3><p>According to <a href="https://en.wikipedia.org/wiki/Web_scraping"><strong>Wikipedia</strong></a>:</p><p><strong>Web scraping</strong>, <strong>web harvesting</strong>, or <strong>web data extraction</strong> is <a href="https://en.wikipedia.org/wiki/Data_scraping">data scraping</a> used for <a href="https://en.wikipedia.org/wiki/Data_extraction">extracting data</a> from <a href="https://en.wikipedia.org/wiki/Website">websites</a>.<a href="https://en.wikipedia.org/wiki/Web_scraping#cite_note-Boeing2016JPER-1">[1]</a> Web scraping software may access the World Wide Web directly using the <a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">Hypertext Transfer Protocol</a>, or through a web browser. While web scraping can be done manually by a software user, the term typically refers to automated processes implemented using a <a href="https://en.wikipedia.org/wiki/Internet_bot">bot</a> or <a href="https://en.wikipedia.org/wiki/Web_crawler">web crawler</a>. It is a form of copying, in which specific data is gathered and copied from the web, typically into a central local <a href="https://en.wikipedia.org/wiki/Database">database</a> or spreadsheet, for later <a href="https://en.wikipedia.org/wiki/Data_retrieval">retrieval</a> or <a href="https://en.wikipedia.org/wiki/Data_analysis">analysis</a>.</p><p>Lets grab the price list gadget. one of the prerequisites of writing web scrapper is that you should good enough to use HTML Inspector provided in web browsers because if you don’t know which markup or tag need to be pick you can’t get your should be helpful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EgsTq853X0cW3qJ51sMS_A.jpeg" /><figcaption>HTML Inspector(Google Chrome)</figcaption></figure><p>You can see, the title of the Ad is written in the li tag. It’s important: try to narrow down your choices as much as possible, especially when you choose one entry because if you only choose generic HTML tags, there is a possibility that there are more than one tag on that page. but on the web page the li tag is only one and unique.</p><p>after you have found the tag that displays the ad title, the next step is to find the code that displays pagging on the webpage. On the webpage above for the pagging list, it is marked with mytotalPage ID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eO_G6c68Dwo9EATzXPcXWw.png" /><figcaption>HTML Inspector (Google Chrome)</figcaption></figure><p>now I will publish the code to scratch the list of gadget price data in the online store</p><pre>import bs4 as bs<br>import urllib.request</pre><pre>myUrl=urllib.request.urlopen(&quot;<a href="https://www.jd.id/search?keywords=samsung">https://www.jd.id/search?keywords=samsung</a>&quot;).read()<br> soup = bs.BeautifulSoup(myUrl,&#39;html.parser&#39;)<br> maxpage = soup.findAll(&quot;input&quot;,{&quot;id&quot;:&quot;mytotalPage&quot;})<br> total_max = str(maxpage[0][&#39;value&#39;])<br> #print(total_max)</pre><pre>par = int(total_max)<br> for param in range(1,par):<br>  keywords = str(param)<br>  myUrl=urllib.request.urlopen(&quot;<a href="https://www.jd.id/search?keywords=samsung&amp;page=">https://www.jd.id/search?keywords=samsung&amp;page=</a>&quot;+keywords+&quot;&quot;).read()<br>  soup = bs.BeautifulSoup(myUrl,&#39;html.parser&#39;)<br>  containers = soup.findAll(&quot;li&quot;,{&quot;class&quot;:&quot; &quot;})</pre><pre>for container in containers:<br>   titel_container = container.findAll(&quot;a&quot;,{&quot;class&quot;:&quot;name&quot;})<br>   product_name = titel_container[0].text</pre><pre>harga_container = container.findAll(&quot;span&quot;,{&quot;eptid&quot;:&quot;price&quot;})<br>   harga_name = harga_container[0].text<br>   harga = harga_name.replace(&#39;,&#39;,&#39;&#39;).replace(&#39;Rp&#39;,&#39;&#39;).replace(&#39; &#39;,&#39;&#39;)</pre><pre>print(&quot;Product : &quot; + product_name)<br>  print(&quot;Harga : &quot; + harga)<br>  print(&quot;Page : &quot; + keywords)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1218cf1256d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>