Giter Club home page Giter Club logo

lcsc-product-fetch's Introduction

lcsc-product-fetch

Python script to scrape product details from lcsc.com's web page.
Output is written out to a CSV file.

Requirements

Python 3 or newer is required to run this.
The dependencies listed in the requirements.txt file must also be satisfied:

  • alive-progress
  • requests

You can do this with python -m pip install -r requirements.txt

Usage

python main.py <file | inline> <path | product_code[,product_code...]>
               |--- mode ---|  |------- path / product_codes -------|

Arguments:

  • mode: mode to operate in, either file or inline
  • path: path to a file containing the product codes to fetch.
  • product_code: one or more product codes.

Product code format:

In both modes, LCSC product codes should be provided as such:

C######,C######,C######...

Modes of operation:

  • file:
    In this mode the product codes in the file at path will be fetched and the output will be saved to path + ".csv"
  • inline:
    In this mode, the product codes in the product_codes argument will be fetched and the output will be saved to output.csv

Example usage:

python3 main.py inline C191386,C104604,C621

Console output:

Looking up product codes... |████████████████████████████████████████| 3/3 [100%] in 1.4s (2.13/s)
Found 2 out of 3 products.
Dropping the following product codes:
  - C621
Scraping product details from HTML... |████████████████████████████████████████| 2/2 [100%] in 1.5s (1.32/s)
Output written to output.csv

Output:

LCSC Product Code Amount in Stock Package Manufacturer Manufacturer Part Number Product Description
C191386 31120 DIP-4 Orient ORPC-817C TransistorOptocouplers 1 5000Vrms DIP-4 Optocouplers RoHS
C104604 89700 1206 RALEC RTT06105JTP 1MΩ ±5% 1/4W ±100ppm/℃ 1206 Chip Resistor - Surface Mount RoHS

output.csv:

LCSC Product Code,Amount in Stock,Package,Manufacturer,Manufacturer Part Number,Product Description
"C191386","31120","DIP-4","Orient","ORPC-817C","TransistorOptocouplers 1 5000Vrms DIP-4 Optocouplers RoHS"
"C104604","89700","1206","RALEC","RTT06105JTP","1MΩ ±5% 1/4W ±100ppm/℃ 1206 Chip Resistor - Surface Mount RoHS"

lcsc-product-fetch's People

Contributors

manuel-covas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.