rohithpr / py-web-search

A Python module to fetch and parse results from different search engines.
MIT License
77 stars 26 forks source link

Repairs and new add #15

Closed zatmar closed 8 years ago

zatmar commented 9 years ago

Hi! I´ve used Python 3 for the try Repair warning error in google.py with beautifulsoup4 (html5 parser) I've added domain support for google. Very useful for SEO tools I´ve upgraded the example code

Sorry for my bad english..

rohithpr commented 9 years ago

Hey, it looks good! I hadn't even thought of it :p A couple of changes-

  1. Do you mind passing the location as an argument in the URL rather than changing the domain itself? This way we can support both Bing and Google consistently. I found this article that might help you out.
  2. It would be better if the new argument to the function is present at the end so that any existing code that users have won't break when they update to a new version of pws. You'll have to change the signatures of 4 functions and the calls to these functions.
zatmar commented 9 years ago

The support that I added to the domain was for the SEO. For example if you will search in google Spain the web "lacrioliposis.es" with the keyword crioliposis, in the results you can see it in fourth position. But if you search it on Chile, you can see it in sixth position. What you told me it is referred to search webs with a determined end. This option serves to compare the position of your page on google depending on the country that you search.

Example: captura

rohithpr commented 9 years ago

I understand what you are saying, but the same can be simulated by passing the country code as an argument in the URL itself.

Example: 1) https://www.google.com/search?q=delta&gl=in returns results as seen in India. It mentions some stores in India etc. 2) https://www.google.com/search?q=delta&gl=uk returns results for the UK which omits the stores in India.

This satisfies what you're trying to do and can be done on both Bing (argument name is cc) and Google (argument name is gl).

zatmar commented 9 years ago

I'm sorry it had not understood before, I tried what you said and goolge works, in bing not give any result, that is to say the search gives the same result even if you add the code for another country.

I was looking for information on the label "& gl =" and only found information in 2010, I think the domain system will make it easier for novice people. But as you want to I do not care the two methods work :+1:

https://en.wikipedia.org/wiki/List_of_Google_domains

rohithpr commented 9 years ago

Calling it country code instead of domain would help simplify things for users who don't want to get into the details.. :p

Bing is buggy even with the "recent" options. :( I'm just trying to make sure that the API is consistent for both the engines so that end users don't face any issues understanding it.