MAsad789565 commited on
Commit
e789120
1 Parent(s): fa9ef68

Update documents/query_results_extractor.py

Browse files
documents/query_results_extractor.py CHANGED
@@ -23,7 +23,11 @@ class QueryResultsExtractor:
23
  else:
24
  site = "Unknown"
25
  url = result.find("a")["href"]
26
- title = result.find("h3").text.strip()
 
 
 
 
27
 
28
  abstract_element_conditions = [
29
  {"data-sncf": "1"},
@@ -53,6 +57,7 @@ class QueryResultsExtractor:
53
  logger.success(f"- {len(query_result_elements)} query results")
54
 
55
 
 
56
  def extract_related_questions(self):
57
  related_question_elements = self.soup.find_all(
58
  "div", class_="related-question-pair"
 
23
  else:
24
  site = "Unknown"
25
  url = result.find("a")["href"]
26
+ title_element = result.find("h3")
27
+ if title_element:
28
+ title = title_element.text.strip()
29
+ else:
30
+ title = "Unknown Title"
31
 
32
  abstract_element_conditions = [
33
  {"data-sncf": "1"},
 
57
  logger.success(f"- {len(query_result_elements)} query results")
58
 
59
 
60
+
61
  def extract_related_questions(self):
62
  related_question_elements = self.soup.find_all(
63
  "div", class_="related-question-pair"