Remove sone google classes.
This commit is contained in:
parent
43dae28a36
commit
845fba5f32
1 changed files with 5 additions and 3 deletions
8
main.py
8
main.py
|
|
@ -97,7 +97,9 @@ def googlepage_to_cleanhtml(googlehtml,searchstring="",currentpage=1):
|
|||
postamble = "</body></html>"
|
||||
results = ""
|
||||
for h3 in searchresults.select("h3"):
|
||||
preview = str(h3.parent.parent.parent.parent.parent.next_sibling.div)
|
||||
preview = h3.parent.parent.parent.parent.parent.next_sibling.div
|
||||
del preview["class"]
|
||||
del preview["style"]
|
||||
heading = h3.string
|
||||
cite = h3.parent.cite
|
||||
del cite["class"]
|
||||
|
|
@ -115,7 +117,7 @@ def googlepage_to_cleanhtml(googlehtml,searchstring="",currentpage=1):
|
|||
url = geturlfromdata(h3.parent['data-sb'])
|
||||
except:
|
||||
url = h3.parent['href']
|
||||
results = results+imagetag+"<div class=\"source\">"+str(source)+"<br/>"+str(cite)+"</div><h3><a href=\""+url+"\">"+heading+"</a></h3><p>"+preview+"</p>"
|
||||
results = results+imagetag+"<div class=\"source\">"+str(source)+"<br/>"+str(cite)+"</div><h3><a href=\""+url+"\">"+heading+"</a></h3><p>"+str(preview)+"</p>"
|
||||
navigation = soup.find("td", attrs={"role":"heading"}).parent
|
||||
pagetds = navigation.find_all("td")
|
||||
del pagetds[0]
|
||||
|
|
@ -150,4 +152,4 @@ if __name__ == "__main__":
|
|||
pass
|
||||
|
||||
webServer.server_close()
|
||||
print("Server stopped.")
|
||||
print("Server stopped.")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue