0

I am using xgoogle to return top 10 url for a given keyword. The code is:

from xgoogle.search import GoogleSearch
gs = GoogleSearch("google scraper")
gs.results_per_page = 10
results = gs.get_results()
for res in results:
 print res.url.encode('utf8')

The problem is it only prints few url in random order. Any help would be appreciated, thank you !!

sulav_lfc
  • 772
  • 2
  • 14
  • 34

1 Answers1

0

try this to get the urls from google.

from google import search
for url in search('put your search query here', stop=15):
    print(url)

you can limit the no. of urls by using stop=any no. you want.

do reply if it worked for you.

Regards Sourabh

Tim
  • 41,901
  • 18
  • 127
  • 145
Sourabh Choudhary
  • 217
  • 1
  • 5
  • 18
  • It returned me relevant results but all of the results it showed were not similar with that of the search results. – sulav_lfc May 07 '14 at 06:20
  • Its giving you the best related query result. you should refine your keyword relevancy in this case like search for (any player your favorite with his team name) – Sourabh Choudhary May 09 '14 at 08:30