Beautifulsoup + googleapi

All

Intro

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

Beautifulsoup

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:

query

domain

number of results

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

REFs

inline

Leave a Reply

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

WordPress.com Logo

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

Google photo

You are commenting using your Google 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