Update main.py
Browse files
main.py
CHANGED
@@ -100,10 +100,18 @@ def proxy(path):
|
|
100 |
# Replace the text with empty string
|
101 |
element.replace_with('')
|
102 |
|
103 |
-
# Filter out README content
|
104 |
for element in soup.find_all(string=re.compile('README', re.IGNORECASE)):
|
105 |
element.replace_with('')
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
# Redirect part number links to Google search
|
108 |
# Look for links that contain part numbers (typically in the second column of the table)
|
109 |
part_number_links = soup.select('td:nth-child(2) a')
|
|
|
100 |
# Replace the text with empty string
|
101 |
element.replace_with('')
|
102 |
|
103 |
+
# Filter out README content and other unnecessary elements
|
104 |
for element in soup.find_all(string=re.compile('README', re.IGNORECASE)):
|
105 |
element.replace_with('')
|
106 |
|
107 |
+
# Remove zoom links (+/-) and "Image not loaded?" link
|
108 |
+
for link in soup.find_all('a'):
|
109 |
+
href = link.get('href', '')
|
110 |
+
if 'zoom=' in href or link.string == '+' or link.string == '-':
|
111 |
+
link.decompose()
|
112 |
+
elif link.string and 'Не загрузилось изображение?' in link.string:
|
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')
|