Spaces:
Runtime error
Runtime error
Commit
·
9b9bd70
1
Parent(s):
7ef4196
Create utils.py
Browse files- steps/utils.py +17 -0
steps/utils.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def get_priority_link(links: list):
|
| 3 |
+
'''
|
| 4 |
+
Function to return the highest priority website link idx with the type of website
|
| 5 |
+
|
| 6 |
+
Args: List of links from google search
|
| 7 |
+
Returns:
|
| 8 |
+
Highest priority search result TAG and its index
|
| 9 |
+
'''
|
| 10 |
+
for i in range(len(links)):
|
| 11 |
+
link = links[i]
|
| 12 |
+
if link!=None:
|
| 13 |
+
#We can add other websites here
|
| 14 |
+
|
| 15 |
+
#For Craft
|
| 16 |
+
if('https://craft.co/' in link and 'competitors' in link):
|
| 17 |
+
return ("craft",i)
|