## parse everything in a single page
import time
from urllib import request
from bs4 import BeautifulSoup
t1 = time.time()
for i in range(10):
url = "http://outlet.lenovo.com/SEUILibrary/controller/e/outlet_us/LenovoPortal/en_US/catalog.workflow:show-category-with-items?acc=true&category-id=7FCAD587E909113E3FB719E59569CDAC&&results-mode=1&RQ_SORT_ORDER1=1&page-size=1000"
with request.urlopen(url) as conneciton:
doc = conneciton.read()
soup = BeautifulSoup(doc)
items = soup.find_all("tr", attrs={"valign":"top"})
item_counter = 0
t2 = time.time()
for item in items:
try:
btn_cart = item.select("img.htButton")
xml_specs = item.select("ul.std-bullet-list")
if not btn_cart or not xml_specs: continue
item_counter += 1
except:
continue
print("Parsing time: %d" % ((time.time() - t2)*1000))
print("Items: %d" % item_counter)
print(time.time() - t1)