ootiq / hanapin

Simple web search library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hanapin

Simple web search library

Install

$ pip3 install hanapin

Usage

Google

from hanapin import Google

# you can explicitly add the count result with the `count` argument, 
#   `search = Google(query="hello", count=1)`
# search results may not yield the exact specified count
search = Google(query="hello")

Bing

from hanapin import Bing

# you can explicitly add the count result with the `count` argument, 
#   `search = Bing(query="hello", count=1)`
# search results may not yield the exact specified count
search = Bing(query="hello")

DuckDuckGo

from hanapin import DuckDuckGo

# explicitly setting search results count is not applicable,
search = DuckDuckGo(query="hello")

Ask.com

from hanapin import Ask

# explicitly setting search results count is not applicable,
search = Ask(query="hello")

Get search results

Scraped search results are only the first ones the can be seen from the search engine's results.

  • Search results are accesible from the class object's .results() function.
for i in search.results():
    print(i["title"], "::", i["link"])

Credits

Libraries Used

  • BeautifulSoup4
  • requests
  • lxml

© TheBoringDude | MIT License

About

Simple web search library

License:MIT License


Languages

Language:Python 98.7%Language:Shell 1.3%