adpro commited on
Commit
1208102
·
verified ·
1 Parent(s): 2c9f149

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -13,14 +13,15 @@ def run_lora(prompt,site,start,end):
13
  # to search
14
  page = requests.get("https://www.google.com/search?q=inurl:" +site + " " +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end)
15
  print("https://www.google.com/search?q=inurl:" +site + " " +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end)
16
- #html_page = urllib.request.urlopen("https://www.google.com/search?q=inurl:" +site + " " +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end)
17
- soup = BeautifulSoup(page.content,"html.parser")
18
  import re
19
  links = soup.findAll("a")
20
  mLink=""
21
- for link in links:
22
- print("Link:", link.get("href"), "Text:", link.string)
23
- mLink+=str(link.get("href")).replace("/url?q=","").replace("'","")
 
24
  return mLink
25
 
26
  with gr.Blocks() as app:
 
13
  # to search
14
  page = requests.get("https://www.google.com/search?q=inurl:" +site + " " +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end)
15
  print("https://www.google.com/search?q=inurl:" +site + " " +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end)
16
+ soup = BeautifulSoup(page.content)
17
+ features="html.parser"
18
  import re
19
  links = soup.findAll("a")
20
  mLink=""
21
+ #for link in soup.find_all("a", "html.parser", parse_only=SoupStrainer('a')):
22
+ for link in soup.find_all("a","html.parser",href=re.compile("(?<=/url\?q=)(htt.*://.*)")):
23
+ print (re.split(":(?=http)",link["href"].replace("/url?q=","")))
24
+ mLink+=str(re.split(":(?=http)",link["href"].replace("/url?q=","").replace("'","")))
25
  return mLink
26
 
27
  with gr.Blocks() as app: