This commit is contained in:
Luke Rogers 2013-12-11 17:31:57 +13:00
parent e94c607b3e
commit cda99f1852
3 changed files with 8 additions and 4 deletions

View file

@ -2,6 +2,8 @@ from util import hook, http, text, web
import json
import re
## CONSTANTS
ITEM_URL = "http://www.newegg.com/Product/Product.aspx?Item={}"
API_PRODUCT = "http://www.ows.newegg.com/Products.egg/{}/ProductDetails"
@ -10,6 +12,8 @@ API_SEARCH = "http://www.ows.newegg.com/Search.egg/Advanced"
NEWEGG_RE = (r"(?:(?:www.newegg.com|newegg.com)/Product/Product\.aspx\?Item=)([-_a-zA-Z0-9]+)", re.I)
## OTHER FUNCTIONS
def format_item(item, show_url=True):
""" takes a newegg API item object and returns a description """
title = text.truncate_str(item["Title"], 50)