Skip to main content

SE::Google::Trends - Scraper of trending keywords according to Google

Google Trends

Overview of the scraper

Scraper of search queries from Google Trends. The Google Trends scraper can automatically retrieve a list of all categories related to the query, as well as a list of interests by region and time.

You can use automatic query multiplication, substitution of subqueries from files, iteration of alphanumeric combinations and lists to get the maximum possible number of results. Using result filtering, you can immediately clean up the result, removing all unnecessary junk (using negative keywords).

The functionality of A-Parser allows you to save the scraping settings of the SE::Google::Trends scraper for further use (presets), set a scraping schedule, and much more.

Saving results is possible in the form and structure that you need, thanks to the built-in powerful template engine Template Toolkit which allows you to apply additional logic to the results and output data in various formats, including JSON, SQL, and CSV.

Use cases for the scraper

Collected data

  • A list of all categories related to the query, in the format (query, category, popularity percentage)
  • A list of interests over time in the format: time of interest (in Unix format), popularity percentage
  • A list of interests by region in the format: region, popularity percentage
  • A list of related top queries
  • A list of related trending queries

Capabilities

  • The ability to compare data for several keywords, for this they need to be listed separated by commas
  • The ability to choose a country to evaluate the keyword
  • Selection of the period for which to display results
  • Selection of the property for scraping (Web Search, Image Search, News Search, etc.)
  • Selection of the Google Trends category (you can find out the list of categories by using the scraper JS::GoogleTrendsCat)
  • The ability to specify an arbitrary date range
  • Search by category

Usage scenarios

  • Evaluating the amount of traffic for a keyword
  • Searching for new keywords of similar themes
  • To set arbitrary dates, you need to select Custom time in Search time and specify the date range in Custom time range in the format YYYY-MM-DD YYYY-MM-DD
  • Category search ignores the query submitted to the scraper (option Use empty queries(ignore query value))
Spoiler: Example
Example of using the Search time and Custom time options

Queries

As queries, you need to specify keywords, just as if you were entering them directly into the Google search form, for example:

write essay
Football
Waterfall
Speak in english
Cats and dogs
forex
cheap essay

Query substitutions

You can use built-in macros for automatic substitution of subqueries from files, for example, we want to add some list of other words to each query, let's specify several main queries:

essay
article
thesis

In the request format, we will specify a substitution macro for additional words from the Keywords.txt file, this method allows to increase the variability of requests many times over:

{subs:Keywords} $query 

This macro will create as many additional requests as there are in the file for each original search query, which in total will give [number of original requests (domains)] x [number of requests in Keywords file] = [total number of requests] as a result of the macro's work.

For example, if the file Keywords.txt will contain:

buy
cheap

As a result, the substitution macro will turn 3 main queries into 6:

buy essay
cheap essay
buy article
cheap article
buy thesis
cheap thesis

Output results examples

A-Parser supports flexible formatting of results thanks to the built-in Template Toolkit, which allows it to output results in any form, as well as in structured formats, such as CSV or JSON

Exporting a list of related queries in trend in the format: original query, related keyword, popularity.

Result format:

$query:\n$related_queries_rising.format('$key,$rquery,$interest\n')

Example of result:

write essay:
write essay,write my essay 4 me,6550
write essay,write essay on globalization and 21st century,1450
write essay,grammarly,1100
write essay,how to write a hook for an argumentative essay,1000
write essay,write my essay for me cheap,1000
write essay,pay someone to write my essay,550
write essay,write that essay login,550
write essay,write my essay cheap,500
write essay,google docs,350
write essay,docs,300
write essay,how to write an argumentative essay step by step,250
write essay,someone write my essay,200
write essay,how long does it take to write a 1000 word essay,200
write essay,how long does it take to write a 2000 word essay,200
write essay,how to write a synthesis essay ap lang,200
write essay,pay to write essay,190
write essay,write essay on my school,180
write essay,how to write essay in hindi,170
write essay,write an essay on my school,170
write essay,help me write an essay,150
write essay,write my essay for me,130
write essay,help me write my essay,120
write essay,write my paper for me,120
write essay,how to write a hook for a persuasive essay,110
write essay,write essay for me,100

The built-in utility $tools.CSVLine allows creating correct table documents, ready for import into Excel or Google Sheets.

General result format:

[% FOREACH i IN p1.related_queries_rising;
tools.CSVline(i.key, i.rquery, i.interest);
END %]

File name:

$datefile.format().csv

Starting text:

Исходный запрос,Связанное ключевое слово,Популярность

tip

In the General results format, Template Toolkit is used to output the array $related_queries_rising in a FOREACH loop.

In the file name of the results, you just need to change the file extension to csv.

To make the "Starting text" option available in the Task Editor, you need to activate "More options". In "Starting text" we write the names of the columns separated by commas and make the second line empty.

Saving in SQL format

Result format:

[%  FOREACH related_queries_rising;     "INSERT INTO serp VALUES('" _ key _ "', '";     rquery _ "', '";    interest _ "')\n"; END  %]

Example of result:

INSERT INTO serp VALUES('write essay', 'write my essay 4 me', '6550')
INSERT INTO serp VALUES('write essay', 'write essay on globalization and 21st century', '1450')
INSERT INTO serp VALUES('write essay', 'grammarly', '1100')
INSERT INTO serp VALUES('write essay', 'how to write a hook for an argumentative essay', '1000')
INSERT INTO serp VALUES('write essay', 'write my essay for me cheap', '1000')
INSERT INTO serp VALUES('write essay', 'pay someone to write my essay', '550')
INSERT INTO serp VALUES('write essay', 'write that essay login', '550')
INSERT INTO serp VALUES('write essay', 'write my essay cheap', '500')
INSERT INTO serp VALUES('write essay', 'google docs', '350')
INSERT INTO serp VALUES('write essay', 'docs', '300')
INSERT INTO serp VALUES('write essay', 'how to write an argumentative essay step by step', '250')
INSERT INTO serp VALUES('write essay', 'someone write my essay', '200')
INSERT INTO serp VALUES('write essay', 'how long does it take to write a 1000 word essay', '200')
INSERT INTO serp VALUES('write essay', 'how long does it take to write a 2000 word essay', '200')
INSERT INTO serp VALUES('write essay', 'how to write a synthesis essay ap lang', '200')
INSERT INTO serp VALUES('write essay', 'pay to write essay', '190')
INSERT INTO serp VALUES('write essay', 'write essay on my school', '180')
INSERT INTO serp VALUES('write essay', 'how to write essay in hindi', '170')
INSERT INTO serp VALUES('write essay', 'write an essay on my school', '170')
INSERT INTO serp VALUES('write essay', 'help me write an essay', '150')
INSERT INTO serp VALUES('write essay', 'write my essay for me', '130')
INSERT INTO serp VALUES('write essay', 'help me write my essay', '120')
INSERT INTO serp VALUES('write essay', 'write my paper for me', '120')
INSERT INTO serp VALUES('write essay', 'how to write a hook for a persuasive essay', '110')
INSERT INTO serp VALUES('write essay', 'write essay for me', '100')
...

Dumping results to JSON

Result format:

[% IF notFirst;
",\n";
ELSE;
notFirst = 1;
END;

obj = {};
obj.related_queries_rising.key = [];
obj.related_queries_rising.rquery = [];
obj.related_queries_rising.interest = [];

FOREACH item IN p1.related_queries_rising;
obj.related_queries_rising.key.push(item.key);
obj.related_queries_rising.rquery.push(item.key);
obj.related_queries_rising.interest.push(item.key);
END;

obj.json %]

Starting text:

[

Ending text:

]

Example of result:

[{"related_queries_rising":{"rquery":["write my essay 4 me","write essay on globalization and 21st century","grammarly","how to write a hook for an argumentative essay","write my essay for me cheap","pay someone to write my essay","write that essay login","write my essay cheap","google docs","docs","how to write an argumentative essay step by step","someone write my essay","how long does it take to write a 1000 word essay","how long does it take to write a 2000 word essay","how to write a synthesis essay ap lang","pay to write essay","write essay on my school","how to write essay in hindi","write an essay on my school","help me write an essay","write my essay for me","help me write my essay","write my paper for me","how to write a hook for a persuasive essay","write essay for me"],"interest":[6550,1450,1100,1000,1000,550,550,500,350,300,250,200,200,200,200,190,180,170,170,150,130,120,120,110,100],"key":["write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay","write essay"]}}]
tip

To make the "Starting text" and "Ending text" options available in the Task Editor, you need to activate "More options".

Results processing

A-Parser allows processing results directly during scraping, in this section we have provided the most popular cases for the scraper SE::Google::Trends

Using an arbitrary date

To set arbitrary dates, you need to select Custom time in Search time and specify the date range in Custom time range in the format YYYY-MM-DD YYYY-MM-DD.

Download example

How to import example into A-Parser

eJx1U1GP2jAM/iuVxcNN4hDctJe+cWhMm9j1dsATQqeIuCy7NMmSlA1V/e9z0tIC
46RKjZ3vsz/HdgWeuTf3bNGhd5BuKjDxDCksP6fpF633EtN0ZVFxl9wna4fJrnRe
FwlnHmEIhlmHNnA3NygE4JizUnoYVuCPBimyPqC1gge24GQ7ZHb389WLIrgOTJYB
1aSB+n1eg7jmPYwfxvfjCX0JHen/kY5Qb7dDoNJIiZtrW7BQ4sBMRm293eWSHXCl
6TIXEnv3nKwnVoQEg1B5uB3lMdDdh5H/GyIwzoUXWjHZZAiP0mddK/E7ClSasHS0
At3cUokpeIwBgvN4UreBQbSBQpSR+6PhQJoz6XAIjqTOGQnh1zfCo2Ve28wEPeSv
QKuplAs8oOxhMf5jKSSnDk5zIn1tibch2X8x6q6881TUpz+WNHRRovWYfe9ZXC/0
/vQYUhTCk+1mulShMWNyviGa7s2eAqzQFrs0beQ2O02woXkjZN+yqeldF2VctOXS
udMqF/usHbQTslQrWpNMzXRhJIa6VCkltcXhSz8eU9e2IRi9wGvyLKYgWd1igNda
um/LRqqxgsbvUxBY0EueZ21D7piU65fF+Q30I0VGfO4EnWNHCHCPe02DRMXU225j
u6Wvbu1tWtXUpV/uuQGHkqKT9oxMagGkk/ofqyh6IQ==

Filtering results

Example of exporting a list of related queries in trend, the popularity of which is below a specified value.

Example of filtering
Download example

How to import example into A-Parser

eJxtVMFu2zAM/ZVACNAVcIP20IsPA9JgKTpkddekpzQohIoOtMiSK8pZA8P/PkqW
7aTLzaRIvsdH0jVzHHf4ZAHBIUvXNSvDN0vZ8kea3huzVZCmKwta4OhqNJfKgR3B
Jy9KBSxhJbcI1qeuz2RQgICcV8qxpGbuUAIVNnuwVgqfLQXZubEFdwQbwtieq8qH
jT8qsIf09VWPLSjuQLx5jwR8sxKl3k7axG8X4x0ckrEN8clYamII6Cjx4pI1A24e
uBNChErX7HxhTywWYZsk5q3aIt+PGN5eX5NlSieNJhNBI2s2mw4A54Gfb6W8mURd
+8cl38PKtLRgcJPA8MiLIIAgbv61a/Ry4j59BS6E9JhctQhe/QH1RcuPQE8bio2d
za0pyOUgFAhKdezWUWnfahVyf7c5LM25QkgYEtU5JyLi64skYbgzNgsakL9mRk+V
WsAe1BAW6t9VUglalWlOSQ8x8XxI9l+Npm/vGIoW6a8lDn2VYN1lv4YsYRZm24mh
ZCEd2TgzlfaD8fPbAZS9Zo8+rDAWephYOaLTpZS02BQ5jGxaDq6TNk7Gcup8NzqX
2yxeQhdZ6RWdY6Znxl+X70tXStFYEJ6H9ZhiHIM3BoJfk2cBgmj1F8icMQp/Lluq
pZW0freeYEFKHqPGku9cqZfnxfELG1aKjCD3CBD5gflwB1tDi0TNNJv+19D/XOpz
P4i0bmhKf/CpDfYtBSddGZnhsG6af/TaovA=
tip

See also: Results filters

Possible settings

Parameter NameDefault ValueDescription
Search regionWorldwideRegion selection
LanguageEnglishLanguage selection
Search timeDefault(Past 5 years)Select the time period for displaying results
Custom time rangeEmpty stringEnter a custom date range when Search time = Custom time (format YYYY-MM-DD YYYY-MM-DD)
Search category id0Category selection
Search propertyDefault(Web Search)Selection of property for scraping (Web Search / Image Search / News Search / Google Shopping / YouTube Search)
Use empty queries(ignore query value)Ignores the query value supplied to the scraper and performs a search by category