Skip to content

Instantly share code, notes, and snippets.

@bmjjr
Forked from Bouni/lcsc-search-api.py
Created January 22, 2025 21:50
Show Gist options
  • Save bmjjr/825360c7f6b1824f3a16ecf2ee016566 to your computer and use it in GitHub Desktop.
Save bmjjr/825360c7f6b1824f3a16ecf2ee016566 to your computer and use it in GitHub Desktop.

Revisions

  1. @Bouni Bouni created this gist Mar 8, 2022.
    329 changes: 329 additions & 0 deletions lcsc-search-api.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,329 @@
    from pprint import PrettyPrinter

    import requests

    pp = PrettyPrinter()

    def query(search)
    url = f"https://wwwapi.lcsc.com/v1/search/global-search?keyword={search}"
    r = requests.get(url)
    pp.pprint(r.json())


    if __name__ == "__main__":
    query("DS2411")


    # result is
    """
    {
    "brandHomeVO": null,
    "catalogVOS": [
    {
    "catalogId": 575,
    "parentId": null,
    "parentName": null,
    "catalogName": null,
    "catalogNameEn": "Interface ICs",
    "childCatelogs": [
    {
    "catalogId": 11179,
    "parentId": null,
    "parentName": null,
    "catalogName": null,
    "catalogNameEn": "Pre-ordered Chips",
    "childCatelogs": null,
    "productNum": 2
    },
    {
    "catalogId": 11133,
    "parentId": null,
    "parentName": null,
    "catalogName": null,
    "catalogNameEn": "Security Verification / Encryption ICs",
    "childCatelogs": null,
    "productNum": 1
    }
    ],
    "productNum": 3
    }
    ],
    "productSearchResultVO": {
    "totalCount": 3,
    "currentPage": 1,
    "pageSize": 25,
    "productList": [
    {
    "productId": 1621637,
    "productCode": "C1530836",
    "productWeight": 0.001,
    "foreignWeight": 0,
    "isOnsale": true,
    "dollarLadderPrice": null,
    "isForeignOnsale": true,
    "minBuyNumber": 1,
    "maxBuyNumber": -1,
    "isAutoOffsale": null,
    "minPacketUnit": "Tube",
    "productUnit": "Piece",
    "productArrange": "Tube-packed",
    "minPacketNumber": 120,
    "encapStandard": "TSOC-6",
    "productModel": "DS2411P+",
    "brandId": 234,
    "brandNameEn": "Maxim Integrated",
    "catalogId": 11179,
    "catalogName": "Pre-ordered Chips",
    "parentCatalogId": 575,
    "parentCatalogName": "Interface ICs",
    "productDescEn": null,
    "productIntroEn": " TSOC-6 Pre-ordered Chips ROHS",
    "isHasBattery": false,
    "isDiscount": false,
    "isHot": false,
    "isEnvironment": true,
    "isPreSale": true,
    "productLadderPrice": "1~9~6.76,10~29~6.76,30~199~6.76,200~499~2.62,500~999~2.53,1000~-1~2.48,",
    "ladderDiscountRate": null,
    "productPriceList": [
    {
    "ladder": 1,
    "usdPrice": 1.2191,
    "currencyPrice": 1.2191,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 200,
    "usdPrice": 0.4725,
    "currencyPrice": 0.4725,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 500,
    "usdPrice": 0.4563,
    "currencyPrice": 0.4563,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 1000,
    "usdPrice": 0.4473,
    "currencyPrice": 0.4473,
    "currencySymbol": "US$",
    "discountRate": null
    }
    ],
    "stockJs": 0,
    "stockSz": 0,
    "smtAloneNumberSz": null,
    "smtAloneNumberJs": null,
    "stockNumber": 0,
    "split": 1,
    "productImageUrl": null,
    "pdfUrl": "",
    "productImages": null,
    "paramVOList": null,
    "isReel": false,
    "reelPrice": null,
    "productModelHighlight": "<span style=\"background-color:#ff0;\">DS2</span><span style=\"background-color:#ff0;\">4</span><span style=\"background-color:#ff0;\">1</span><span style=\"background-color:#ff0;\">1</span>P+",
    "productCodeHighlight": null,
    "catalogCode": "01170827",
    "parentCatalogCode": "011708",
    "pdfLinkUrl": null,
    "weight": 0.001
    },
    {
    "productId": 16300,
    "productCode": "C15619",
    "productWeight": 0.033,
    "foreignWeight": 0.058,
    "isOnsale": true,
    "dollarLadderPrice": null,
    "isForeignOnsale": true,
    "minBuyNumber": 1,
    "maxBuyNumber": -1,
    "isAutoOffsale": null,
    "minPacketUnit": "Reel",
    "productUnit": "Piece",
    "productArrange": "Tape & Reel (TR)",
    "minPacketNumber": 3000,
    "encapStandard": "SOT-23(SOT-23-3)",
    "productModel": "DS2411R+T&R",
    "brandId": 234,
    "brandNameEn": "Maxim Integrated",
    "catalogId": 11133,
    "catalogName": "Security Verification / Encryption ICs",
    "parentCatalogId": 575,
    "parentCatalogName": "Interface ICs",
    "productDescEn": null,
    "productIntroEn": " SOT-23(SOT-23-3) Security Verification / Encryption ICs ROHS",
    "isHasBattery": false,
    "isDiscount": false,
    "isHot": false,
    "isEnvironment": true,
    "isPreSale": false,
    "productLadderPrice": "1~9~24.95,10~29~20.40,30~99~17.10,100~499~14.38,500~999~13.91,1000~1999~13.68,2000~3999~13.51,4000~-1~13.40,",
    "ladderDiscountRate": null,
    "productPriceList": [
    {
    "ladder": 1,
    "usdPrice": 4.4992,
    "currencyPrice": 4.4992,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 10,
    "usdPrice": 3.6787,
    "currencyPrice": 3.6787,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 30,
    "usdPrice": 3.0837,
    "currencyPrice": 3.0837,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 100,
    "usdPrice": 2.5932,
    "currencyPrice": 2.5932,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 500,
    "usdPrice": 2.5084,
    "currencyPrice": 2.5084,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 1000,
    "usdPrice": 2.4669,
    "currencyPrice": 2.4669,
    "currencySymbol": "US$",
    "discountRate": null
    }
    ],
    "stockJs": 1439,
    "stockSz": 302,
    "smtAloneNumberSz": null,
    "smtAloneNumberJs": null,
    "stockNumber": 1741,
    "split": 1,
    "productImageUrl": "https://assets.lcsc.com/images/lcsc/96x96/20190221_Maxim-Integrated-DS2411R-T-R_C15619_front.jpg",
    "pdfUrl": "https://datasheet.lcsc.com/lcsc/1809191936_Maxim-Integrated-DS2411R-T-R_C15619.pdf",
    "productImages": [
    "/20190221_Maxim-Integrated-DS2411R-T-R_C15619_front.jpg",
    "/20190221_Maxim-Integrated-DS2411R-T-R_C15619_back.jpg",
    "/20190221_Maxim-Integrated-DS2411R-T-R_C15619_blank.jpg",
    "/20190307_Maxim-Integrated-DS2411R-T-R_C15619_package.jpg"
    ],
    "paramVOList": null,
    "isReel": false,
    "reelPrice": null,
    "productModelHighlight": "<span style=\"background-color:#ff0;\">DS2</span><span style=\"background-color:#ff0;\">4</span><span style=\"background-color:#ff0;\">1</span><span style=\"background-color:#ff0;\">1</span>R+T&R",
    "productCodeHighlight": null,
    "catalogCode": "01170834",
    "parentCatalogCode": "011708",
    "pdfLinkUrl": null,
    "weight": 0.058,
    "productImageUrlBig": "https://assets.lcsc.com/images/lcsc/900x900/20190221_Maxim-Integrated-DS2411R-T-R_C15619_front.jpg"
    },
    {
    "productId": 2742290,
    "productCode": "C2650381",
    "productWeight": 0.001,
    "foreignWeight": 0,
    "isOnsale": true,
    "dollarLadderPrice": null,
    "isForeignOnsale": true,
    "minBuyNumber": 1,
    "maxBuyNumber": -1,
    "isAutoOffsale": null,
    "minPacketUnit": "Reel",
    "productUnit": "Piece",
    "productArrange": "Tape & Reel (TR)",
    "minPacketNumber": 4000,
    "encapStandard": "TSOC-6",
    "productModel": "DS2411P+T&R",
    "brandId": 234,
    "brandNameEn": "Maxim Integrated",
    "catalogId": 11179,
    "catalogName": "Pre-ordered Chips",
    "parentCatalogId": 575,
    "parentCatalogName": "Interface ICs",
    "productDescEn": null,
    "productIntroEn": " TSOC-6 Pre-ordered Chips ROHS",
    "isHasBattery": false,
    "isDiscount": false,
    "isHot": false,
    "isEnvironment": true,
    "isPreSale": true,
    "productLadderPrice": "1~9~8.45,10~29~8.45,30~199~8.45,200~499~3.27,500~999~3.16,1000~-1~3.10,",
    "ladderDiscountRate": null,
    "productPriceList": [
    {
    "ladder": 1,
    "usdPrice": 1.5238,
    "currencyPrice": 1.5238,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 200,
    "usdPrice": 0.5897,
    "currencyPrice": 0.5897,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 500,
    "usdPrice": 0.5699,
    "currencyPrice": 0.5699,
    "currencySymbol": "US$",
    "discountRate": null
    },
    {
    "ladder": 1000,
    "usdPrice": 0.5591,
    "currencyPrice": 0.5591,
    "currencySymbol": "US$",
    "discountRate": null
    }
    ],
    "stockJs": 0,
    "stockSz": 0,
    "smtAloneNumberSz": null,
    "smtAloneNumberJs": null,
    "stockNumber": 0,
    "split": 1,
    "productImageUrl": null,
    "pdfUrl": "",
    "productImages": null,
    "paramVOList": null,
    "isReel": false,
    "reelPrice": null,
    "productModelHighlight": "<span style=\"background-color:#ff0;\">DS2</span><span style=\"background-color:#ff0;\">4</span><span style=\"background-color:#ff0;\">1</span><span style=\"background-color:#ff0;\">1</span>P+T&R",
    "productCodeHighlight": null,
    "catalogCode": "01170827",
    "parentCatalogCode": "011708",
    "pdfLinkUrl": null,
    "weight": 0.001
    }
    ],
    "totalPage": 1,
    "lastPage": 1
    },
    "lcBookProductResultVO": null,
    "isToDetail": null,
    "isToBrand": null,
    "tipProductDetailUrlVO": null,
    "brandUrlMap": null
    }
    """