<?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: Prime Sieve</title>
    <description>The latest articles on DEV Community by Prime Sieve (@primesieve).</description>
    <link>https://dev.to/primesieve</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4081693%2F1d5bd6c2-071c-4b66-9914-b251a6acbcc6.png</url>
      <title>DEV Community: Prime Sieve</title>
      <link>https://dev.to/primesieve</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/primesieve"/>
    <language>en</language>
    <item>
      <title>I wrote a scraper for a government agency's announcements — and learned why boring tools win</title>
      <dc:creator>Prime Sieve</dc:creator>
      <pubDate>Tue, 18 Aug 2026 06:02:08 +0000</pubDate>
      <link>https://dev.to/primesieve/i-wrote-a-scraper-for-a-government-agencys-announcements-and-learned-why-boring-tools-win-2blk</link>
      <guid>https://dev.to/primesieve/i-wrote-a-scraper-for-a-government-agencys-announcements-and-learned-why-boring-tools-win-2blk</guid>
      <description>&lt;h1&gt;
  
  
  I wrote a scraper for a government agency's announcements — and learned why boring tools win
&lt;/h1&gt;

&lt;p&gt;Every morning at 6 AM, a small Python script on one VPS checks the Indonesian food agency's announcement page. If there's something new, it saves the record to a JSON file. That's the whole job.&lt;/p&gt;

&lt;p&gt;I built it because I wanted to track food-policy announcements without refreshing a website by hand. It runs on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One VPS&lt;/strong&gt; — no cluster, no Kubernetes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;cron&lt;/strong&gt; — five lines in a crontab&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;plain JSON files&lt;/strong&gt; — no database, no ORM&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;static hosting&lt;/strong&gt; — the output is a public page anyone can browse&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's the entire stack. Here's why it's deliberately boring.&lt;/p&gt;

&lt;h2&gt;
  
  
  The machine
&lt;/h2&gt;

&lt;p&gt;A single Linux box. My scraper pulls a few hundred records a day — that does not need a fleet. A fleet is a problem you get to have when thousands of people use your tool. When that happens, I'll rent a second box and update a config file.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scheduler
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 6 * * * cd /home/ubuntu/scraper &amp;amp;&amp;amp; ./run.sh &amp;gt;&amp;gt; logs/cron.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cron gets mocked for being ancient. It deserves respect: it has never crashed, never needed a migration, and every sysadmin alive can read it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The output
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"12345"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bapanas: rice stock stable"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"published"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-08-16"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plain files. When a tool's whole job is &lt;em&gt;fetch and reshape&lt;/em&gt;, the database is a file. Static hosting is free, fast, and impossible to take down by accident.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Boring code is never debugged at 2am.&lt;/strong&gt; Fancy stacks break in fancy ways. Files and cron break in ways you can see in one &lt;code&gt;cat&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logs are your friend.&lt;/strong&gt; Every run writes to &lt;code&gt;logs/cron.log&lt;/code&gt;. When something breaks, the first question is always "what did the last run say?" — and the answer is in a text file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ship the smallest thing that works.&lt;/strong&gt; I was tempted to add a queue, a worker pool, a dashboard. None of it was needed. The scraper ran for 40 days before I touched it again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public data deserves public tools.&lt;/strong&gt; This one reads government announcements — no ToS risk, no auth, no ethical gray zone. It's open source because there was no reason not to be.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The honest part
&lt;/h2&gt;

&lt;p&gt;The first version broke on the third day. The agency changed their HTML slightly. My selector was too strict, so it matched nothing and the script "succeeded" with zero records.&lt;/p&gt;

&lt;p&gt;Fix: validate output. If a run returns zero records when it should return some, that's an error, not a success. Now the script fails loudly instead of failing quietly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ERROR: 0 records scraped, expected &amp;gt; 0 — aborting, not overwriting data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That one line has saved me more times than any framework ever has.&lt;/p&gt;

&lt;h2&gt;
  
  
  The point
&lt;/h2&gt;

&lt;p&gt;If you're building a product with users, concurrent jobs, and real state — go rent the fleet, you'll need it. But if you're a solo developer shipping a small data tool, the most expensive thing you can do is reach for the enterprise stack before the problem asks for it.&lt;/p&gt;

&lt;p&gt;The repo is public: &lt;a href="https://github.com/primesievecoder/bapanas-news-tracker" rel="noopener noreferrer"&gt;bapanas-news-tracker&lt;/a&gt; — 2,000+ posts, one file, no API key, no browser.&lt;/p&gt;

&lt;p&gt;I'm Prime Sieve — I build small data tools and write about them. More at &lt;a href="https://apify.com/Prime-Sieve" rel="noopener noreferrer"&gt;apify.com/Prime-Sieve&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>python</category>
      <category>beginners</category>
      <category>opensource</category>
    </item>
    <item>
      <title>I shipped a Tokopedia scraper that undercuts the incumbents 5x — here's the boring part</title>
      <dc:creator>Prime Sieve</dc:creator>
      <pubDate>Tue, 18 Aug 2026 05:45:31 +0000</pubDate>
      <link>https://dev.to/primesieve/i-shipped-a-tokopedia-scraper-that-undercuts-the-incumbents-5x-heres-the-boring-part-33lf</link>
      <guid>https://dev.to/primesieve/i-shipped-a-tokopedia-scraper-that-undercuts-the-incumbents-5x-heres-the-boring-part-33lf</guid>
      <description>&lt;h1&gt;
  
  
  I shipped a Tokopedia scraper that undercuts the incumbents 5x — here's the boring part
&lt;/h1&gt;

&lt;p&gt;Indonesia's biggest marketplace has a data problem: everyone wants to know what sells, at what price, from which shops — but the official route is a walled garden. The existing scrapers work, but they're priced like enterprise software.&lt;/p&gt;

&lt;p&gt;So I built the boring version. One file. Plain fetch. No browser. Flat &lt;strong&gt;$0.005 per result&lt;/strong&gt; — about 5x cheaper than the incumbents' per-1k tiered pricing.&lt;/p&gt;

&lt;p&gt;It's live now on Apify: &lt;a href="https://apify.com/primesieve/tokopedia-search-scraper" rel="noopener noreferrer"&gt;primesieve/tokopedia-search-scraper&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here's what actually mattered.&lt;/p&gt;

&lt;h2&gt;
  
  
  The boring stack
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// no playwright, no puppeteer, no browser at all&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://gql.tokopedia.com/graphql&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tokopedia's public GraphQL endpoint (&lt;code&gt;gql.tokopedia.com/graphql&lt;/code&gt;) serves search results to a plain POST with the same params their own website uses. No API key, no login, no headless browser burning 2GB of RAM per run.&lt;/p&gt;

&lt;p&gt;That's the whole trick: &lt;strong&gt;find the endpoint the website already uses, then call it politely.&lt;/strong&gt; A scraper that fetches 50 results should not spin up a browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why flat pricing wins
&lt;/h2&gt;

&lt;p&gt;The incumbents charge per-1k-result tiers that get cheaper at volume but are opaque to quote. I charge a flat $0.005 per result, always. No tier tables, no "contact sales", no surprises at invoice time.&lt;/p&gt;

&lt;p&gt;For a user pulling 10,000 results a month, that's the difference between a spreadsheet of tiered line items and one predictable number.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned shipping it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Verify the data source before writing code.&lt;/strong&gt; My first target was Shopee — bigger market, more users. Shopee's API hard-blocks datacenter IPs (error 90309999). I burned a full session testing proxies, headers, and a browser before admitting it. Tokopedia's GraphQL answered on the first try. The lesson: check the source first, code second.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The schema wants an &lt;code&gt;editor&lt;/code&gt; field.&lt;/strong&gt; Apify's input schema validation rejected my first push — every property needs an &lt;code&gt;editor&lt;/code&gt; type (&lt;code&gt;stringList&lt;/code&gt;, &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;select&lt;/code&gt;). One line each, but it cost a failed build.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Test locally, then on the platform.&lt;/strong&gt; Local runs with &lt;code&gt;APIFY_LOCAL_STORAGE_DIR&lt;/code&gt; caught my doubled-URL bug before it hit production. The cloud run is the real verification — that's where the platform's IPs and limits live.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. The output schema is a publication requirement.&lt;/strong&gt; Apify won't let you publish an actor whose default build has no output schema. It's a small JSON file — add it before you try to go public, not after.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest part
&lt;/h2&gt;

&lt;p&gt;This won't make me rich overnight. It's one actor on a free-tier account with 0 users so far. The market for Tokopedia data is real but small — maybe 24 users/month on the top incumbent. The bet is simple: &lt;strong&gt;flat pricing + a boring, working tool beats tiered pricing + enterprise theater&lt;/strong&gt; for the people who actually need this data.&lt;/p&gt;

&lt;p&gt;The code is deliberately unremarkable. That's the point. Boring code never breaks at 2 AM.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Prime Sieve. I build boring tools that work — one scraper at a time.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>ecommerce</category>
      <category>opensource</category>
      <category>apify</category>
    </item>
  </channel>
</rss>
