joshuadunlop commited on
Commit
65f2fc7
·
verified ·
1 Parent(s): 37f4f66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -13
app.py CHANGED
@@ -74,7 +74,7 @@ api_login = st.sidebar.text_input("API Login", value="[email protected]
74
  api_key = st.sidebar.text_input("API Key", type="password")
75
 
76
  # Filters input
77
- regex_patterns = st.sidebar.text_area("Enter URL patterns to exclude (regex, separated by new lines)")
78
  is_lost = st.sidebar.checkbox("Is Lost", value=False)
79
  dofollow = st.sidebar.checkbox("Dofollow", value=True)
80
  backlink_spam_score = st.sidebar.slider("Backlink Spam Score ≤", 0, 100, 10)
@@ -84,18 +84,12 @@ is_broken = st.sidebar.checkbox("Is Broken", value=False)
84
  # Prepare filters for API call
85
  filters = []
86
 
87
- if regex_patterns:
88
- for pattern in regex_patterns.split('\n'):
89
- if pattern.strip(): # Make sure the pattern is not empty
90
- # Format the regex pattern for the API call
91
- # Escape special characters if necessary
92
- formatted_pattern = pattern.strip().replace('.', '\.')
93
- formatted_pattern = f"%{formatted_pattern}%"
94
- filters.append(["url_from", "not_like", formatted_pattern])
95
- filters.append("and")
96
-
97
- # Debugging: Print out the final filters before the API call
98
- st.text(f"Final Filters: {filters}")
99
 
100
  if is_lost:
101
  filters.append(["is_lost", "=", is_lost])
 
74
  api_key = st.sidebar.text_input("API Key", type="password")
75
 
76
  # Filters input
77
+ url_from_exclusions = st.sidebar.text_area("Exclude URLs containing (newline-separated)")
78
  is_lost = st.sidebar.checkbox("Is Lost", value=False)
79
  dofollow = st.sidebar.checkbox("Dofollow", value=True)
80
  backlink_spam_score = st.sidebar.slider("Backlink Spam Score ≤", 0, 100, 10)
 
84
  # Prepare filters for API call
85
  filters = []
86
 
87
+ if url_from_exclusions:
88
+ exclusion_list = [exclusion.strip() for exclusion in re.split('[,\n]+', url_from_exclusions)]
89
+ for idx, url in enumerate(exclusion_list):
90
+ filters.append(["url_from", "not_like", url])
91
+ if idx < len(exclusion_list) - 1:
92
+ filters.append("or")
 
 
 
 
 
 
93
 
94
  if is_lost:
95
  filters.append(["is_lost", "=", is_lost])