<?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: Hao</title>
    <description>The latest articles on DEV Community by Hao (@liuhao04).</description>
    <link>https://dev.to/liuhao04</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%2F4044236%2F289e92a2-c37e-480f-aad8-830aa21d09d3.png</url>
      <title>DEV Community: Hao</title>
      <link>https://dev.to/liuhao04</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/liuhao04"/>
    <language>en</language>
    <item>
      <title>How to get LCSC component prices and stock as JSON (no login, no API key)</title>
      <dc:creator>Hao</dc:creator>
      <pubDate>Thu, 23 Jul 2026 18:23:28 +0000</pubDate>
      <link>https://dev.to/liuhao04/how-to-get-lcsc-component-prices-and-stock-as-json-no-login-no-api-key-2ekb</link>
      <guid>https://dev.to/liuhao04/how-to-get-lcsc-component-prices-and-stock-as-json-no-login-no-api-key-2ekb</guid>
      <description>&lt;p&gt;If you build hardware, you have hit this: you have a BOM full of LCSC part codes&lt;br&gt;
(&lt;code&gt;C1591&lt;/code&gt;, &lt;code&gt;C25804&lt;/code&gt;, the &lt;code&gt;C#####&lt;/code&gt; numbers on every LCSC and JLCPCB line item), and you&lt;br&gt;
want the &lt;strong&gt;live price ladder and stock&lt;/strong&gt; as structured data — to cost a build, to&lt;br&gt;
watch prices, or to enrich a component database. LCSC has no public pricing API, and&lt;br&gt;
the search endpoints are protected. So how do you get the data cleanly?&lt;/p&gt;

&lt;p&gt;This post shows the pragmatic approach, why the obvious ones break, and a zero-setup&lt;br&gt;
way to get one clean JSON record per part.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why the obvious approaches break
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scraping the search API&lt;/strong&gt; — it is rate-limited and CAPTCHA-protected; reverse-
engineering it means fighting anti-bot systems that change often. High-maintenance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Headless-browser clicking&lt;/strong&gt; — heavy, slow, and brittle against layout changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual copy-paste&lt;/strong&gt; — fine for three parts, not for a 200-line BOM you re-cost weekly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The stable surface is the &lt;strong&gt;public product-detail page&lt;/strong&gt; (&lt;code&gt;/product-detail/...&lt;/code&gt;). It is&lt;br&gt;
allowed by LCSC's &lt;code&gt;robots.txt&lt;/code&gt;, it carries the full data (price tiers, stock, package,&lt;br&gt;
MOQ, parametric specs, datasheet URL) in the page's own JSON, and it does not require a&lt;br&gt;
login. Read &lt;em&gt;that&lt;/em&gt;, one lightweight request per part, and you get reliable results&lt;br&gt;
without an anti-bot arms race.&lt;/p&gt;
&lt;h2&gt;
  
  
  The data you actually want, per part
&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="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"productCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C1591"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mpn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CL10B104KB8NNNC"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"brand"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Samsung"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"100nF ±10% 50V X7R 0603 MLCC"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"stock"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;512340&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"package"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0603"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"minOrderQty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"priceTiers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"qty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"usd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0019&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"qty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"usd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0011&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"qty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"usd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0007&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"datasheetUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://www.lcsc.com/product-detail/C1591.html"&lt;/span&gt;&lt;span class="w"&gt;
&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;That is spreadsheet-ready and diff-able: store it, re-fetch weekly, and you can watch&lt;br&gt;
price and stock move over time.&lt;/p&gt;
&lt;h2&gt;
  
  
  The zero-setup route
&lt;/h2&gt;

&lt;p&gt;Rather than maintain scraper code yourself, you can run a hosted actor that does exactly&lt;br&gt;
the above — reads only public product pages, returns one clean record per code:&lt;br&gt;
&lt;a href="https://apify.com/minty_modesty/lcsc-parts-scraper" rel="noopener noreferrer"&gt;&lt;strong&gt;LCSC Parts Scraper&lt;/strong&gt;&lt;/a&gt; on Apify.&lt;/p&gt;

&lt;p&gt;Input is just your list of codes:&lt;br&gt;
&lt;/p&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="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"productCodes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"C1591"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C25804"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C7593"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"includePriceTiers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"includeSpecs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&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;Call it from the API / CLI and pull the dataset as JSON or CSV:&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="c"&gt;# start a run and wait, then fetch the dataset&lt;/span&gt;
curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s2"&gt;"https://api.apify.com/v2/acts/minty_modesty~lcsc-parts-scraper/runs?token=&lt;/span&gt;&lt;span class="nv"&gt;$APIFY_TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'content-type: application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"productCodes":["C1591","C25804"],"includePriceTiers":true}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because it reads public pages at low volume, it keeps working where search-API scrapers&lt;br&gt;
get blocked. Feed it your BOM, get back cost data.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to roll your own instead
&lt;/h2&gt;

&lt;p&gt;If you only ever need a couple of parts, just open the product page. If you need&lt;br&gt;
&lt;strong&gt;keyword → part codes&lt;/strong&gt;, resolve codes first (from your BOM or on lcsc.com) — this&lt;br&gt;
approach is deliberately code-first to stay on stable pages. And if you need account-&lt;br&gt;
specific contract pricing, that lives behind your LCSC login and no public method will&lt;br&gt;
reach it.&lt;/p&gt;

&lt;p&gt;For the common case — turning a list of LCSC codes into clean, structured price/stock/&lt;br&gt;
spec data for BOM costing or price monitoring — reading the public product pages is the&lt;br&gt;
reliable path, and a hosted actor removes the maintenance entirely.&lt;/p&gt;

</description>
      <category>electronics</category>
      <category>api</category>
      <category>webscraping</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
