#!/usr/bin/env python3
# google: Fetch URLs from Google Search

# requires: googlesearch-python

from googlesearch import search
import argparse

def main():
	parser = argparse.ArgumentParser(description='Fetch URLs from Google Search.')
	parser.add_argument('query', type=str, help='search query')
	parser.add_argument('n', type=int, default=20, help='number of results')
	args = parser.parse_args()

	res = search(args.query, num_results=args.n)
	for r in list(res)[0:args.n]:
		print(r)

main()
