Search Digi-Key from your terminal
Searching Digi-Key can be a pain. Here's a list of things I do every time I search for an item:
- Filter by "In Stock"
- Filter by "Quantity Desired: 1"
- Sort by price, ascending
Each of those actions takes a click and a couple seconds to load. I can automate these tasks and do most of the work from the command line.
- Search for blue LEDs:
digiglass blue led
- Search for 470-ohm resistors in the through-hole category:
digiglass -c 'through hole resistor' 470 ohm
- Browse all resistor kits:
digiglass --category 'resistor kit'
--category are interchangeable. Category names support fuzzy search - you can type part of the name and the proper category will probably appear.
This is a Python 3 script, so use
pip3 to install:
pip3 install digiglass
Specify a filter to be used during a search like this:
digiglass --filter some_new_filter
You can customize the filters used by Digiglass by modifying
~/.digiglass. It's a YAML file that looks like this:
filters: my_filter: in_stock: true lead_free: false rohs_compliant: false sort_by: '1000011' # Unit price, USD, ascending min_quantity: 1 pb_rohs: lead_free: true rohs_compliant: true settings: default_filter: my_filter
Valid options are:
in_stock: Item must be in stock
lead_free: Item must be lead free
rohs_compliant: Item must be RoHS compliant
sort_by: The column by which to sort results
min_quantity: At least this many of this item must be available
Every field in a filter is optional.
default_filter is used when no filter is specified.
Fields not specified in a requested filter use the default filter's settings.
Having issues? Try clearing the app's cache:
Still having issues? Odds are Digi-Key changed their HTML format. They probably broke the app's screen scraping. Let me know and I'll try and fix it—or dig in yourself! Screen scraping is fun.
Copyright (c) 2014 Matthew Lewis. Licensed under the MIT License.