Beautifulsoup + googleapi



I recently posted that with some python libs. I think beautifulsoup is on this list.


Beautifulsoup is this very nice thing treat html content, quite nice.  The code below takes the the content from hmtl and returns the content without html tags.

from bs4 import BeautifulSoup
#Get Content
def get_content(url="test\solution.html"):
    #content = urllib.request.urlopen(url).read()
    #soup = BeautifulSoup(content, features="html.parser")
    soup = BeautifulSoup(open("test\solution.html"), "html.parser")
    return soup.text

Google Search

To do queries on google search is quite simple, with this lib – the query is done as below:



number of results

search(query, tld="com", num=n_result, stop=1, pause=2):



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s