Update main.py
Browse files
main.py
CHANGED
@@ -113,13 +113,13 @@ def proxy(path):
|
|
113 |
link.decompose()
|
114 |
|
115 |
# Redirect part number links to Google search
|
116 |
-
# Look for links that contain part numbers
|
117 |
-
part_number_links = soup.select('td
|
118 |
for link in part_number_links:
|
119 |
# Get the part number from the link text
|
120 |
part_number = link.text.strip()
|
121 |
-
# Check if it matches a part number pattern (alphanumeric with possible spaces)
|
122 |
-
if re.match(r'^[A-Z0-9 ]+$', part_number):
|
123 |
# Create a Google search URL for this part number with avto.pro
|
124 |
google_search_url = f"https://www.google.com/search?q={part_number} avto.pro"
|
125 |
# Update the link's href attribute and add target="_blank" to open in new tab
|
|
|
113 |
link.decompose()
|
114 |
|
115 |
# Redirect part number links to Google search
|
116 |
+
# Look for links that contain part numbers in any table cell
|
117 |
+
part_number_links = soup.select('td a')
|
118 |
for link in part_number_links:
|
119 |
# Get the part number from the link text
|
120 |
part_number = link.text.strip()
|
121 |
+
# Check if it matches a part number pattern (alphanumeric with possible spaces and dashes)
|
122 |
+
if re.match(r'^[A-Z0-9 -]+$', part_number) and not any(x in part_number.upper() for x in ['README', 'ZOOM']):
|
123 |
# Create a Google search URL for this part number with avto.pro
|
124 |
google_search_url = f"https://www.google.com/search?q={part_number} avto.pro"
|
125 |
# Update the link's href attribute and add target="_blank" to open in new tab
|