adpro commited on
Commit
7fcc4cf
·
verified ·
1 Parent(s): d803a0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -15,11 +15,12 @@ def run_lora(prompt,site,start,end):
15
  url = f"https://www.google.com/search?q=inurl:{site}+{prompt}&tbs=cdr%3A1%2Ccd_min%3A{start}%2Ccd_max%3A {end}"
16
  response = requests.get(url)
17
  soup = BeautifulSoup(response.text, 'html.parser')
18
- print(soup)
19
  links = soup.findAll("a")
20
- mLink=""
21
- extract_results(soup)
22
-
 
 
23
  def extract_results(soup):
24
  main = soup.select_one("#main")
25
 
@@ -27,6 +28,7 @@ def extract_results(soup):
27
  for gdiv in main.select('.g, .fP1Qef'):
28
  res.append(extract_section(gdiv))
29
  return res
 
30
  def extract_section(gdiv):
31
  # Getting our elements
32
  title = gdiv.select_one('h3')
 
15
  url = f"https://www.google.com/search?q=inurl:{site}+{prompt}&tbs=cdr%3A1%2Ccd_min%3A{start}%2Ccd_max%3A {end}"
16
  response = requests.get(url)
17
  soup = BeautifulSoup(response.text, 'html.parser')
 
18
  links = soup.findAll("a")
19
+ for link in soup.find_all("a",href=re.compile("(?<=/url\?q=)(htt.*://.*)")):
20
+ print(re.split(":(?=http)",extract_href(link["href"])))
21
+ j = extract_results(soup)
22
+ print(j)
23
+
24
  def extract_results(soup):
25
  main = soup.select_one("#main")
26
 
 
28
  for gdiv in main.select('.g, .fP1Qef'):
29
  res.append(extract_section(gdiv))
30
  return res
31
+
32
  def extract_section(gdiv):
33
  # Getting our elements
34
  title = gdiv.select_one('h3')