<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: mateuszbuda</title>
    <description>The latest articles on Forem by mateuszbuda (@mateuszbuda).</description>
    <link>https://forem.com/mateuszbuda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F986630%2F29857b19-b041-4d37-8a23-0d505098acaf.jpeg</url>
      <title>Forem: mateuszbuda</title>
      <link>https://forem.com/mateuszbuda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mateuszbuda"/>
    <language>en</language>
    <item>
      <title>The State of Web Scraping 2023 Survey</title>
      <dc:creator>mateuszbuda</dc:creator>
      <pubDate>Thu, 11 May 2023 08:46:14 +0000</pubDate>
      <link>https://forem.com/mateuszbuda/the-state-of-web-scraping-2023-survey-44a2</link>
      <guid>https://forem.com/mateuszbuda/the-state-of-web-scraping-2023-survey-44a2</guid>
      <description>&lt;p&gt;We're excited to share that we've just launched the 'State of Web Scraping 2023' survey. Embracing the spirit of open knowledge, we aim to help the web scraping community understand itself better. That's why we're making both raw data and results publicly available. Our goal is to turn this into an annual endeavor, similar to what other tech communities do.&lt;/p&gt;

&lt;p&gt;To participate in the 'State of Web Scraping 2023' survey, please follow this link: &lt;a href="https://forms.gle/Wsi24nWHHe2qLbPZ8"&gt;https://forms.gle/Wsi24nWHHe2qLbPZ8&lt;/a&gt;.&lt;br&gt;
As a thank you for your time, we're offering a 50% discount on our web scraping API, Scraping Fish, to all participants.&lt;/p&gt;

&lt;p&gt;Whether you're a seasoned web scraper, a software developer, a business owner, or just starting out in the field, your experiences and insights are invaluable. The survey covers a wide range of topics: from your role and expertise in web scraping, the tools and languages you prefer, to your thoughts on the ethics and challenges associated with web scraping.&lt;/p&gt;

&lt;p&gt;Thank you in advance for your time and insights. We can't wait to share the collective knowledge we gather from this endeavor.&lt;/p&gt;

&lt;p&gt;Also, if you have any feedback on the survey itself or if there's anything more you'd want to learn about the web scraping community, please let us know.&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>webdev</category>
      <category>datascience</category>
      <category>python</category>
    </item>
    <item>
      <title>Scraping Google SERP with Geolocation</title>
      <dc:creator>mateuszbuda</dc:creator>
      <pubDate>Thu, 08 Dec 2022 11:46:06 +0000</pubDate>
      <link>https://forem.com/mateuszbuda/scraping-google-serp-with-geolocation-4f1m</link>
      <guid>https://forem.com/mateuszbuda/scraping-google-serp-with-geolocation-4f1m</guid>
      <description>&lt;p&gt;Google Search Engine Result Pages (SERP) 🔍 are an important source of information for many businesses. SERP includes organic search results, ads, products, places, knowledge graphs, etc. For example, by scraping Google SERP you can learn which brands have paid ads for specific keywords or analyze how your website is positioned.&lt;/p&gt;

&lt;p&gt;One of the most important factors affecting what the user can see on a keyword's SERP is geolocation 🗺. We'll show you how to scrape Google SERP for a keyword from any location, regardless of the origin of your IP address. This can be done simply by setting search URL query parameters. It's also possible to parametrize and automate scraping 🤖 using a python script we share below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Google Search URL​
&lt;/h2&gt;

&lt;p&gt;Let's start with a basic Google search query for a keyword.&lt;/p&gt;

&lt;p&gt;The URL for Google search is &lt;a href="https://www.google.com/search" rel="noopener noreferrer"&gt;https://www.google.com/search&lt;/a&gt; and the keyword is provided in q query parameter. The keyword must be &lt;a href="https://www.w3schools.com/tags/ref_urlencode.ASP" rel="noopener noreferrer"&gt;URL encoded&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An example URL for &lt;code&gt;kitchen sink&lt;/code&gt; keyword is &lt;a href="https://www.google.com/search?q=kitchen+sink" rel="noopener noreferrer"&gt;https://www.google.com/search?q=kitchen+sink&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Geolocation​
&lt;/h2&gt;

&lt;p&gt;To add geolocation to the search URL, you just have to add two query parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;uule&lt;/code&gt; for specific location and&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gl&lt;/code&gt; for country.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The URL for &lt;code&gt;kitchen sink&lt;/code&gt; keyword results from the United States would be: &lt;a href="https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICINVW5pdGVkIFN0YXRlcw&amp;amp;gl=us" rel="noopener noreferrer"&gt;https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICINVW5pdGVkIFN0YXRlcw&amp;amp;gl=us&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A few examples for other countries and locations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;India: &lt;a href="https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIFSW5kaWE&amp;amp;gl=in" rel="noopener noreferrer"&gt;https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIFSW5kaWE&amp;amp;gl=in&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Brazil: &lt;a href="https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIGQnJhemls&amp;amp;gl=br" rel="noopener noreferrer"&gt;https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIGQnJhemls&amp;amp;gl=br&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Germany: &lt;a href="https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIHR2VybWFueQ&amp;amp;gl=de" rel="noopener noreferrer"&gt;https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIHR2VybWFueQ&amp;amp;gl=de&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;California, United States: &lt;a href="https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIYQ2FsaWZvcm5pYSxVbml0ZWQgU3RhdGVz&amp;amp;gl=us" rel="noopener noreferrer"&gt;https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIYQ2FsaWZvcm5pYSxVbml0ZWQgU3RhdGVz&amp;amp;gl=us&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;New York City, United States: &lt;a href="https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIfTmV3IFlvcmssTmV3IFlvcmssVW5pdGVkIFN0YXRlcw&amp;amp;gl=us" rel="noopener noreferrer"&gt;https://www.google.com/search?q=kitchen+sink&amp;amp;uule=w+CAIQICIfTmV3IFlvcmssTmV3IFlvcmssVW5pdGVkIFN0YXRlcw&amp;amp;gl=us&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can confirm that the results are from the desired location in the footer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgq6p2ncitm5y28ifnpfr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgq6p2ncitm5y28ifnpfr.png" alt="Location footer" width="794" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using this method, you can even find local businesses that appear in Google SERP for a specific location. For example, coffee shops in San Francisco, California, United States: &lt;a href="https://www.google.com/search?q=coffee+shop&amp;amp;uule=w+CAIQICImU2FuIEZyYW5jaXNjbyxDYWxpZm9ybmlhLFVuaXRlZCBTdGF0ZXM&amp;amp;gl=us" rel="noopener noreferrer"&gt;https://www.google.com/search?q=coffee+shop&amp;amp;uule=w+CAIQICImU2FuIEZyYW5jaXNjbyxDYWxpZm9ybmlhLFVuaXRlZCBTdGF0ZXM&amp;amp;gl=us&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1wzwn813iis7eplncho9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1wzwn813iis7eplncho9.png" alt="Google SERP coffee shops" width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the URL above you will see results as if you were in San Francisco, CA regardless of your actual location (country origin of your IP address).&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate values for geolocation query params​
&lt;/h2&gt;

&lt;p&gt;Now, how do you know what value to set for &lt;code&gt;uule&lt;/code&gt; and &lt;code&gt;gl&lt;/code&gt; query parameters?&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;gl&lt;/code&gt; param is fairly straightforward as it corresponds to country code. Here is the full list of all available countries: &lt;a href="https://developers.google.com/custom-search/docs/xml_results_appendices#countryCodes" rel="noopener noreferrer"&gt;https://developers.google.com/custom-search/docs/xml_results_appendices#countryCodes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;uule&lt;/code&gt; param is more tricky. To manually generate &lt;code&gt;uule&lt;/code&gt; for desired location, you can use this online tool: &lt;a href="https://site-analyzer.pro/services-seo/uule/" rel="noopener noreferrer"&gt;https://site-analyzer.pro/services-seo/uule/&lt;/a&gt;. A list of all available locations is provided in this CSV file in Canonical Name column: &lt;a href="https://developers.google.com/static/adwords/api/docs/appendix/geo/geotargets-2022-09-14.csv" rel="noopener noreferrer"&gt;https://developers.google.com/static/adwords/api/docs/appendix/geo/geotargets-2022-09-14.csv&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There's a fairly simple algorithm behind generating uule parameter. It involves a fixed prefix, a special key which depends on location string length, and base64 encoding. If you're interested, here is a blog post from MOZ (a SEO tool) which describes it in detail: &lt;a href="https://moz.com/blog/geolocation-the-ultimate-tip-to-emulate-local-search" rel="noopener noreferrer"&gt;https://moz.com/blog/geolocation-the-ultimate-tip-to-emulate-local-search&lt;/a&gt;.&lt;br&gt;
If you need to automate uule parameter generation, there's a python package for this: &lt;a href="https://github.com/ogun/uule_grabber" rel="noopener noreferrer"&gt;https://github.com/ogun/uule_grabber&lt;/a&gt;. It generates uule value for you given the location string. Example usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;uule_grabber&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uule_grabber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Lezigne,Pays de la Loire,France&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will use it later in a script to automate Google SERP web scraping with geolocation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result page language​
&lt;/h2&gt;

&lt;p&gt;The result page language (host language) is another parameter which might be relevant. You set the language in &lt;code&gt;hl&lt;/code&gt; query param.&lt;/p&gt;

&lt;p&gt;For example, the URL for coffee shops in San Francisco in Spanish would be: &lt;a href="https://www.google.com/search?q=coffee+shop&amp;amp;uule=w+CAIQICImU2FuIEZyYW5jaXNjbyxDYWxpZm9ybmlhLFVuaXRlZCBTdGF0ZXM&amp;amp;gl=us&amp;amp;hl=es" rel="noopener noreferrer"&gt;https://www.google.com/search?q=coffee+shop&amp;amp;uule=w+CAIQICImU2FuIEZyYW5jaXNjbyxDYWxpZm9ybmlhLFVuaXRlZCBTdGF0ZXM&amp;amp;gl=us&amp;amp;hl=es&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3thw1mevdr85kx9n9jf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3thw1mevdr85kx9n9jf.png" alt="Google SERP coffee shops Spanish" width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This parameter only affects text displayed by Google on its result page. If you search for an english keyword and the result link is in English, Google will not translate the result description (text snippet you see under the link) if you set a different language in the &lt;code&gt;hl&lt;/code&gt; parameter.&lt;/p&gt;

&lt;p&gt;Here is the full list of all supported language codes: &lt;a href="https://developers.google.com/custom-search/docs/xml_results_appendices#interfaceLanguages" rel="noopener noreferrer"&gt;https://developers.google.com/custom-search/docs/xml_results_appendices#interfaceLanguages&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python code for automated scraping​
&lt;/h2&gt;

&lt;p&gt;Localization of Google SERP is very useful in web scraping and SEO analytics. Below we provide python code which scrapes Google SERP for given keyword with geolocation. To run it, you have to install dependencies: &lt;code&gt;pip install requests uule_grabber&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;urllib.parse&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;quote_plus&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;uule_grabber&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;keyword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# encode search query
&lt;/span&gt;    &lt;span class="n"&gt;keyword&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;quote_plus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keyword&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# grab `uule` based for location string
&lt;/span&gt;    &lt;span class="n"&gt;uule&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;uule_grabber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# full url for desired Google SERP
&lt;/span&gt;    &lt;span class="n"&gt;search_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://www.google.com/search?q=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;keyword&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;uule=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;uule&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;gl=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;hl=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="c1"&gt;# Scraping Fish API url
&lt;/span&gt;    &lt;span class="n"&gt;url_prefix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://scraping.narf.ai/api/v1/?api_key=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;url=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="c1"&gt;# send GET request
&lt;/span&gt;    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;url_prefix&lt;/span&gt;&lt;span class="si"&gt;}{&lt;/span&gt;&lt;span class="nf"&gt;quote_plus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;wb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# save response to file
&lt;/span&gt;        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Result saved to &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR SCRAPING FISH API KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# https://scrapingfish.com/buy
&lt;/span&gt;  &lt;span class="n"&gt;keyword&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;coffee shop&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;California,United States&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;en&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./google.html&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A script with command-line interface is shared in this GitHub repository: &lt;a href="https://github.com/pawelkobojek/scrapingfish-blog-projects/tree/main/google-serp" rel="noopener noreferrer"&gt;https://github.com/pawelkobojek/scrapingfish-blog-projects/tree/main/google-serp&lt;/a&gt;.&lt;br&gt;
To run it, you will need Scraping Fish API key which you can get here: &lt;a href="https://scrapingfish.com/buy" rel="noopener noreferrer"&gt;https://scrapingfish.com/buy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The script uses Scraping Fish API to ensure that you always get relevant SERP content since making too many requests to Google might result in captcha.&lt;br&gt;
Scraping Fish is an API for web scraping powered by ethically-sourced mobile proxies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion​
&lt;/h2&gt;

&lt;p&gt;Google SERP is an important source of information for market analysis, local businesses, and SEO in general. In this blog post, we showed how you can see Google SERP from arbitrary location without using VPN or proxies located in specific countries.&lt;/p&gt;

&lt;p&gt;We have also shared a python code snippet and a script which will let you automate Google SERP web scraping at scale using Scraping Fish API.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
  </channel>
</rss>
