Remove sone google classes.
This commit is contained in:
parent
43dae28a36
commit
845fba5f32
1 changed files with 5 additions and 3 deletions
6
main.py
6
main.py
|
|
@ -97,7 +97,9 @@ def googlepage_to_cleanhtml(googlehtml,searchstring="",currentpage=1):
|
||||||
postamble = "</body></html>"
|
postamble = "</body></html>"
|
||||||
results = ""
|
results = ""
|
||||||
for h3 in searchresults.select("h3"):
|
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
|
heading = h3.string
|
||||||
cite = h3.parent.cite
|
cite = h3.parent.cite
|
||||||
del cite["class"]
|
del cite["class"]
|
||||||
|
|
@ -115,7 +117,7 @@ def googlepage_to_cleanhtml(googlehtml,searchstring="",currentpage=1):
|
||||||
url = geturlfromdata(h3.parent['data-sb'])
|
url = geturlfromdata(h3.parent['data-sb'])
|
||||||
except:
|
except:
|
||||||
url = h3.parent['href']
|
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
|
navigation = soup.find("td", attrs={"role":"heading"}).parent
|
||||||
pagetds = navigation.find_all("td")
|
pagetds = navigation.find_all("td")
|
||||||
del pagetds[0]
|
del pagetds[0]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue