At the moment I'm working on something that parses eBay URLs and let's just say this isn't shaping up to be pretty. The following is a prototype which extracts search keywords from URLs:
def getKW(url):
kw = ''
if getDomain(url) == 'motors.shop.ebay.com':
#url = "http://motors.shop.ebay.com/Parts-Accessories_Car-Truck-Parts-Accessories__f350-wheels-20_W0QQ_fxdZ1QQ_osacatZPartsQ2dAccessoriesQQ_trksidZm270Q2el1313&caz.html"
#f350-wheels-20
kw = urlparse(url)[2].split('__')[1].split('_W0QQ')[0]
if getDomain(url) == 'cgi.ebay.com':
#'http://cgi.ebay.com/ebaymotors/FACTORY-15-Mercedes-E320-300E-OEM-Chrome-Wheels-Rims_W0QQitemZ290277158739QQihZ019QQcategoryZ43955QQssPageNameZWDVWQQrdZ1QQcmdZViewItem&caz.html'
#FACTORY-15-Mercedes-E320-300E-OEM-Chrome-Wheels-Rims
kw = urlparse(url)[2].split('/ebaymotors/')[1].split('_W0QQ')[0]
if getDomain(url) == 'shop.ebay.com':
#url = 'http://shop.ebay.com/items/__mini-cooper-rims?_trkparms=72%3A543%7C66%3A2%7C65%3A12%7C39%3A1&caz.html'
#mini-cooper-rims
kw = urlparse(url)[2].split('/items/__')[1]
return kw if kw else False