rohithpr / py-web-search Goto Github PK
View Code? Open in Web Editor NEWA Python module to fetch and parse results from different search engines.
License: MIT License
A Python module to fetch and parse results from different search engines.
License: MIT License
from pws import Google
from pws import Bing
print(Google.search(query='hello world', num=5, start=2))
print(Bing.search('hello world', 5, 2))
When I run this example, I get this error:
TypeError: init() got an unexpected keyword argument 'strict'
on line 3.
Hello!
Can you add the function which will show only number of search result of various phrases in int type?
For example:
print(Google.search_count('hello world'))
246 000 000
If you will realize it, you will rock. ;)
With regards,
Ivan.
This happen when the query is "strange" or maybe too long or syntactically wrong. For example "ASD adasmd asidjkasd" or "All euro2016 matches of the year" (with no space between Euro and 2016). It can't find related queries. I have handled this by commenting :
if related_queries == []:
related_queries = Bing.scrape_related(soup)
(Ln:113 and Ln:114 of bing.py)
I using python 3.4.3 64 bit in windows 8.
>>> from pws import Google
>>> print(Google.search(query='hello world', num=5, start=2, country_code="es"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\py34\lib\encodings\cp874.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 232-234:
character maps to <undefined>
To reproduce exception:
from pws import Google
Google.query('PB287Q site:.cl')
Using python 3.4.1 and pws 0.2.3
Problem: By performing a lot of searches consecutively, Google detects the bot nature of the Python script and changes its responses into alternative pages with Captcha control.
Solution: While Google starts sending alternative pages, fall back to using Splinter library to perform browser automation with a Human-like behavior by spacing requests with a random wait timer. This is far slower but makes the script continue to work.
Note: If you are interested, let me know as I already implemented this solution. Note that this bypasses Google's control and this will certainly work during a limited time.
How to reproduce bug:
from pws import Google
Google.search('27EA33V site:falabella.com')
Thanks for this tool , very useful .
But I got no results after tested 15-20 keywords . I used browser to check , got captcha check .
When you use this module for searching in Google, there's no JSON response as it sends a simple message with the URL of searching (e.g.: you are looking for 'github', 10 results, and the response of the module is: 'url': 'https://www.google.com/search?q=github&num=10&start=0&tbm=nws#q=github&tbas=0&tbs=sbd:1&tbm=nws&gl=d'
Hello
When I am doing the import as described on docs, I get this error
No module named html.parser
Could you help me?
Thank you
I using python 3.4.3 in windows 8. py-web-search 0.2.4 . At Thailand.
>>> a=Google.search('apple', 10, 2,'d','en')
>>> a
{'total_results': 21480000000, 'search_engine': 'google', 'received_num': 0, 'ex
pected_num': 10, 'country_code': None, 'url': 'https://www.google.com/search?q=a
pple&num=10&start=2', 'start': 2, 'related_queries': ['apple watch', 'apple tv',
'apple watch \ufffd\u04a4\ufffd', 'apple show', 'apple \ufffd\ufffd\ufffd\u047e
\ufffd\ufffd', 'appleaa', 'apple itune', 'apple tv \ufffd\u04a4\ufffd'], 'result
s': []}
>>> a=Google.search_news('apple', 10, 2,'d','en')
>>> a
{'num': 10, 'total_results': 2168000000, 'country_code': None, 'search_engine':
'google', 'url': 'https://www.google.com/search?q=apple&num=10&start=2&tbm=nws#q
=apple&tbas=0&tbs=sbd:1&tbm=nws&gl=en', 'start': 2, 'results': []}
>>> a=Google.search_news('apple', 10, 0,'d','en')
No have results. About https ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.