@hook.command()
def newegg(text):
 request = {'Keyword': text, 'Sort': 'FEATURED'}
 headers = {'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3', 'Referer': 'http://www.newegg.com/'}
 try:
  request = requests.post('http://www.ows.newegg.com/Search.egg/Advanced', data=json.dumps(request).encode('utf-8'), headers=headers)
 except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError) as e:
  return 'Unable to find product: {}'.format(e)
 r = request.json()
 if r.get('Description', False):
  return 'Newegg Error: {Description} (\x02{Code}\x02)'.format(**r)
 if r['ProductListItems']:
  return format_item(r['ProductListItems'][0])
 else:
  return 'No results found.'

@ hook . command ( ) def newegg ( text ) : request = { 'Keyword' : text , 'Sort' : 'FEATURED' } headers = { 'User-Agent' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3' , 'Referer' : 'http://www.newegg.com/' } try : request = requests . post ( 'http://www.ows.newegg.com/Search.egg/Advanced' , data = json . dumps ( request ) . encode ( 'utf-8' ) , headers = headers ) except ( requests . exceptions . HTTPError , requests . exceptions . ConnectionError ) as e : return 'Unable to find product: {}' . format ( e ) r = request . json ( ) if r . get ( 'Description' , False ) : return 'Newegg Error: {Description} (\x02{Code}\x02)' . format ( ** r ) if r [ 'ProductListItems' ] : return format_item ( r [ 'ProductListItems' ] [ 0 ] ) else : return 'No results found.'
newegg <item name> - searches newegg .