Starchik1 commited on
Commit
9381fae
·
verified ·
1 Parent(s): a6adc49

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -4
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 (typically in the second column of the table)
117
- part_number_links = soup.select('td:nth-child(2) 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)
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