Skip to content

Instantly share code, notes, and snippets.

@Bouni
Created March 8, 2022 07:53
Show Gist options
  • Save Bouni/fabcc1965036d4816c3d48e2dbf6b169 to your computer and use it in GitHub Desktop.
Save Bouni/fabcc1965036d4816c3d48e2dbf6b169 to your computer and use it in GitHub Desktop.
LCSC search API
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
}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment