Skip to content

Instantly share code, notes, and snippets.

@ian-kerins
Created April 12, 2021 13:54

Revisions

  1. ian-kerins created this gist Apr 12, 2021.
    10 changes: 10 additions & 0 deletions google_serp_scrapy_p1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    from urllib.parse import urlparse
    from urllib.parse import urlencode

    def create_google_url(query, site=''):
    google_dict = {'q': query, 'num': 100, }
    if site:
    web = urlparse(site).netloc
    google_dict['as_sitesearch'] = web
    return 'http://www.google.com/search?' + urlencode(google_dict)
    return 'http://www.google.com/search?' + urlencode(google_dict)