You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
647 B

from sample.util.util import findnth, get_items
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
def __find_part_number(parts_list, idx):
return parts_list[idx][(parts_list[idx].find("title=") + 16):findnth(parts_list[idx], " Name:", 1)]
def get_part_number(url):
items = get_items(url)
part_numbers = []
for i in range(len(items)):
current_part = __find_part_number(items, i)
if current_part.startswith("o:"):
current_part = current_part[3:30]
if len(current_part) < 30:
part_numbers.append(current_part)
return part_numbers