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 comment