trendsdotnet 1.0.0
See the version list below for details.
dotnet add package trendsdotnet --version 1.0.0
NuGet\Install-Package trendsdotnet -Version 1.0.0
<PackageReference Include="trendsdotnet" Version="1.0.0" />
paket add trendsdotnet --version 1.0.0
#r "nuget: trendsdotnet, 1.0.0"
// 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.
Endpoint Descriptions (Taken from Google Trends)
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.
Related queries
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.
Related Queries
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 Keyword
s, each of which contains the Query
and a Value
which is a relative score for the term.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- newtonsoft.json (>= 12.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.