mgokg commited on
Commit
af406c2
·
verified ·
1 Parent(s): a0436c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -34,9 +34,8 @@ def list_of_clubs(ort):
34
  try:
35
  response = requests.get(initial_url)
36
  response.raise_for_status()
37
-
38
  soup = BeautifulSoup(response.content, 'html.parser')
39
-
40
  # Determine the last page
41
  link_element = soup.select_one('li.page-item:nth-child(8) > a:nth-child(1)')
42
  last_page = 10
@@ -63,15 +62,8 @@ def list_of_clubs(ort):
63
  return str(e), []
64
 
65
  all_links_text = all_links_text[0::2]
66
-
67
  return all_links_text
68
 
69
- def extract_vereinsname(url):
70
- parts = url.split('/')
71
- vereinsname = parts[-1]
72
- vereinsname = vereinsname.replace("-", " ")
73
- return vereinsname
74
-
75
  def google_search(query):
76
  headers = {
77
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
@@ -84,8 +76,7 @@ def google_search(query):
84
  response = requests.get(url)
85
  soup = BeautifulSoup(response.text, 'html.parser')
86
  #first_div = soup.find('div', class_='MjjYud')
87
- first_div = soup.find('body')
88
-
89
  return first_div.text.strip()
90
 
91
  def process_ort(ort):
@@ -97,7 +88,6 @@ demo = gr.Interface(
97
  fn=process_ort,
98
  inputs=gr.Textbox(lines=1, placeholder="Geben Sie Ihre Suchanfrage ein..."),
99
  outputs="text",
100
- #outputs=gr.Markdown(),
101
  title="google websearch",
102
  description="Geben Sie eine Suchanfrage ein..."
103
  )
 
34
  try:
35
  response = requests.get(initial_url)
36
  response.raise_for_status()
 
37
  soup = BeautifulSoup(response.content, 'html.parser')
38
+
39
  # Determine the last page
40
  link_element = soup.select_one('li.page-item:nth-child(8) > a:nth-child(1)')
41
  last_page = 10
 
62
  return str(e), []
63
 
64
  all_links_text = all_links_text[0::2]
 
65
  return all_links_text
66
 
 
 
 
 
 
 
67
  def google_search(query):
68
  headers = {
69
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
 
76
  response = requests.get(url)
77
  soup = BeautifulSoup(response.text, 'html.parser')
78
  #first_div = soup.find('div', class_='MjjYud')
79
+ first_div = soup.find('body')
 
80
  return first_div.text.strip()
81
 
82
  def process_ort(ort):
 
88
  fn=process_ort,
89
  inputs=gr.Textbox(lines=1, placeholder="Geben Sie Ihre Suchanfrage ein..."),
90
  outputs="text",
 
91
  title="google websearch",
92
  description="Geben Sie eine Suchanfrage ein..."
93
  )