trendsdotnet 1.0.0

.NET Core 3.1
There is a newer version of this package available.
See the version list below for details.
NuGet\Install-Package trendsdotnet -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package trendsdotnet --version 1.0.0
<PackageReference Include="trendsdotnet" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add trendsdotnet --version 1.0.0
#r "nuget: trendsdotnet, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install trendsdotnet as a Cake Addin
#addin nuget:?package=trendsdotnet&version=1.0.0

// Install trendsdotnet as a Cake Tool
#tool nuget:?package=trendsdotnet&version=1.0.0

trendsdotnet

Unofficial C# wrapper around the Google Trends API (https://trends.google.com/). Handles authentication and returns data either in a complex object or as the raw JSON returned from the API. Functionality to compare a collection of terms over a timeline, breakdown interest in terms by region, or retrieve top related queries (ie search suggestions) for a set of terms.


Interest over time

Returns numbers representing search interest relative to the highest point on the chart for the given region and time. A value of 100 is the peak popularity for the term. A value of 50 means that the term is half as popular. A score of 0 means there was not enough data for this term.

Interest by region

See which term ranked highest in each region during the specified time frame. Values are scaled from 0 to 100, where 100 is the region with peak popularity, a value of 50 is the region where the term is half as popular, and a value of 0 means that term was less than 1% as popular as the peak.

Users searching for your term also searched for these queries. Scoring is on a relative scale where a value of 100 is the most commonly searched query, 50 is a query searched half as often as the most popular query, and so on.


Example usages

All functions require a TrendsClient creating:

using(TrendsClient client = new TrendsClient()) {...

Interest over time

Store the terms to be compared in a string array

string[] terms = new string[] { "Google", "Bing" };

Either retrieve the raw JSON data from the API, to be used as needed. Dates and resolution are optional, and default the the below.

string json = await client.GetInterestOverTimeJSON(terms, DateTime.Now.AddYears(-1), DateTime.Now, Resolution.WEEK);

OR recieve the data parsed into a complex object. Dates and resolution are optional, and default the the below.

InterestTimeline data = await client.GetInterestOverTime(terms, DateTime.Now.AddYears(-1), DateTime.Now, Resolution.WEEK);

InterestTimeline data points contain Averages which are average relative scores for the terms, and DataItems which are data points of the collection in time order. All scores are in the order the terms were entered, ie data.DataItems[x].Values[0] is the score of the 1st term and data.DataItems[x].Values[1] is the score of the 2nd when comparing 2 terms.

Interest by region

Store the terms to be compared in a string array

string[] terms = new string[] { "Google", "Bing" };

Either retrieve the raw JSON data from the API, to be used as needed. All parameters but terms are optional, and default the the below.

string json = await client.GetInterestByRegionJSON(terms, DateTime.Parse("2004-01-01"), DateTime.Now, Resolution.COUNTRY, DataMode.PERCENTAGES);

OR recieve the data parsed into a complex object. All parameters but terms are optional, and default the the below.

RegionInterestMap data = await client.GetInterestOverTime(terms, DateTime.Parse("2004-01-01"), DateTime.Now, Resolution.COUNTRY, DataMode.PERCENTAGES);

RegionInterestMap contains MapData with a collection of RegionData data points, each of which contains the RegionCode and RegionName, as well as Values which are average relative scores for the terms. All scores are in the order the terms were entered.
One term per request so no need to create an array of terms
Either retrieve the raw JSON data from the API, to be used as needed. Dates are optional, and default to the below.

string json = await client.GetRelatedQueriesJSON("Google", DateTime.Parse("2004-01-01"), DateTime.Now);

OR recieve the data parsed into a complex object. Dates are optional, and default to the below.

RankedQueryList data = await client.GetRelatedQueries("Google", DateTime.Parse("2004-01-01"), DateTime.Now);

RankedQueryList contains Keywords which is array of Keywords, each of which contains the Query and a Value which is a relative score for the term.
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 310 1/17/2021
1.0.1 217 1/17/2021
1.0.0 196 1/11/2021