0

My overall task is to grap the Google Trends 'interest by region' data automatically with python.

I found the meanwhile well known post:

http://techslides.com/hacking-the-google-trends-api ,

and the actualized python module 'pytrends' which works well for example for the 'interest over time' data of google trends (but has no function for the 'interest by region' data) :

github.com/GeneralMills/pytrends .

In both approaches the underlining url which is requested to receive the desired JSON of the 'interest over time' data goes e.g like:

http://www.google.com/trends/fetchComponent?hl=en-US&q=pizza&cid=TIMESERIES_GRAPH_0&export=3&w=500&h=300 ,

where cid=TIMESERIES_GRAPH_0 determines which data will be requested. The value TIMESERIES_GRAPH_0 stands for the 'interest over time' data.

The author of the post states that this url can be found with the network tab of the developer console of Chrome, while browsing Google Trends. For later beeing able to find the url for the 'interest by region' data, first I wanted to reconstruct the authors explanation and observed the Chrome devoloper console while browsing Google Trends. Yet I did not find any URL request that looks any similar to the above posted url. That brings me to the question:

How is it possible to get to this URL by the Chrome developer console network tab?

And additionally as a shortcut to my overall task:

How do I find out which value I have to enter for the cid=... key to get to the URL which corresponds to the data of the 'interest by region' function of Google Trends?

Thank you in advance

Nzteb
  • 1
  • 2
  • Another idea: click Embed on a full trends page's region map and you'll see a network request for `GEO_MAP?req....` html document with token inside which you can use for a `comparedgeo?req=` request. – wOxxOm Sep 17 '16 at 20:03
  • I found the token following your instructions. The 'two stages' request works fine in Python. Thank you very much! – Nzteb Sep 24 '16 at 16:22
  • Hi Nzteb, could you please give more details on how you did this? I am trying to do the similar thing while having the similar problem here. The token got from the `GEO_MAP` page can not be used directly by the `comparedgeo` request. (I used 2 `curl` commands. Should they be in the same session?). Thanks. – ericzma Jan 21 '17 at 13:31

0 Answers0