@shaivpidadi/trends-js 0.0.0-beta.2 → 0.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +201 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -0,0 +1,201 @@
1
+ 🚧 WIP: Temporary workaround for [#175](https://github.com/pat310/google-trends-api/issues/175)
2
+
3
+ # @shaivpidadi/trends-js
4
+
5
+ A TypeScript library for interacting with the Google Trends API. This package provides a simple and type-safe way to access Google Trends data programmatically.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @shaivpidadi/trends-js
11
+ ```
12
+
13
+ ## Features
14
+
15
+ - Get daily trending topics
16
+ - Get real-time trending topics
17
+ - Get autocomplete suggestions
18
+ - Explore trends data
19
+ - Get interest by region data
20
+ - TypeScript support
21
+ - Promise-based API
22
+
23
+ ## Usage
24
+
25
+ ### Importing
26
+
27
+ ```typescript
28
+ import GoogleTrendsApi from '@shaivpidadi/trends-js';
29
+ ```
30
+
31
+ ### Daily Trends
32
+
33
+ Get daily trending topics for a specific region:
34
+
35
+ ```typescript
36
+ const result = await GoogleTrendsApi.dailyTrends({
37
+ geo: 'US', // Default: 'US'
38
+ lang: 'en' // Default: 'en'
39
+ });
40
+
41
+ // Result structure:
42
+ // {
43
+ // allTrendingStories: Array<...>,
44
+ // summary: string[]
45
+ // }
46
+ ```
47
+
48
+ ### Real-Time Trends
49
+
50
+ Get real-time trending topics:
51
+
52
+ ```typescript
53
+ const result = await GoogleTrendsApi.realTimeTrends({
54
+ geo: 'US', // Default: 'US'
55
+ trendingHours: 4 // Default: 4
56
+ });
57
+
58
+ // Result structure:
59
+ // {
60
+ // allTrendingStories: Array<...>,
61
+ // summary: string[]
62
+ // }
63
+ ```
64
+
65
+ ### Autocomplete
66
+
67
+ Get search suggestions for a keyword:
68
+
69
+ ```typescript
70
+ const suggestions = await GoogleTrendsApi.autocomplete(
71
+ 'bitcoin', // Keyword to get suggestions for
72
+ 'en-US' // Language (default: 'en-US')
73
+ );
74
+
75
+ // Returns: string[]
76
+ ```
77
+
78
+ ### Explore
79
+
80
+ Get widget data for a keyword:
81
+
82
+ ```typescript
83
+ const result = await GoogleTrendsApi.explore({
84
+ keyword: 'bitcoin',
85
+ geo: 'US', // Default: 'US'
86
+ time: 'today 12-m', // Default: 'today 12-m'
87
+ category: 0, // Default: 0
88
+ property: '', // Default: ''
89
+ hl: 'en-US' // Default: 'en-US'
90
+ });
91
+
92
+ // Result structure:
93
+ // {
94
+ // widgets: Array<{
95
+ // id: string,
96
+ // request: {...},
97
+ // token: string
98
+ // }>
99
+ // }
100
+ ```
101
+
102
+ ### Interest by Region
103
+
104
+ Get interest data by region:
105
+
106
+ ```typescript
107
+ const result = await GoogleTrendsApi.interestByRegion({
108
+ keyword: 'Stock Market',
109
+ geo: 'US', // Default: 'US'
110
+ time: 'today 12-m', // Default: 'today 12-m'
111
+ resolution: 'REGION', // Default: 'REGION'
112
+ hl: 'en-US' // Default: 'en-US'
113
+ });
114
+
115
+ // Result structure:
116
+ // {
117
+ // default: {
118
+ // geoMapData: Array<{
119
+ // geoCode: string,
120
+ // geoName: string,
121
+ // value: number[],
122
+ // formattedValue: string[],
123
+ // maxValueIndex: number,
124
+ // hasData: boolean[]
125
+ // }>
126
+ // }
127
+ // }
128
+ ```
129
+
130
+ ## API Reference
131
+
132
+ ### DailyTrendsOptions
133
+
134
+ ```typescript
135
+ interface DailyTrendsOptions {
136
+ geo?: string; // Default: 'US'
137
+ lang?: string; // Default: 'en'
138
+ }
139
+ ```
140
+
141
+ ### RealTimeTrendsOptions
142
+
143
+ ```typescript
144
+ interface RealTimeTrendsOptions {
145
+ geo: string;
146
+ trendingHours?: number; // Default: 4
147
+ }
148
+ ```
149
+
150
+ ### ExploreOptions
151
+
152
+ ```typescript
153
+ interface ExploreOptions {
154
+ keyword: string;
155
+ geo?: string; // Default: 'US'
156
+ time?: string; // Default: 'today 12-m'
157
+ category?: number; // Default: 0
158
+ property?: string; // Default: ''
159
+ hl?: string; // Default: 'en-US'
160
+ }
161
+ ```
162
+
163
+ ### InterestByRegionOptions
164
+
165
+ ```typescript
166
+ interface InterestByRegionOptions {
167
+ keyword: string;
168
+ geo?: string; // Default: 'US'
169
+ time?: string; // Default: 'today 12-m'
170
+ resolution?: 'COUNTRY' | 'REGION' | 'CITY' | 'DMA'; // Default: 'REGION'
171
+ hl?: string; // Default: 'en-US'
172
+ }
173
+ ```
174
+
175
+ ## Development
176
+
177
+ ### Building
178
+
179
+ ```bash
180
+ npm run build
181
+ ```
182
+
183
+ ### Testing
184
+
185
+ ```bash
186
+ npm test
187
+ ```
188
+
189
+ ### Linting
190
+
191
+ ```bash
192
+ npm run lint
193
+ ```
194
+
195
+ ## License
196
+
197
+ MIT
198
+
199
+ ## Author
200
+
201
+ Shaishav Pidadi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaivpidadi/trends-js",
3
- "version": "0.0.0-beta.2",
3
+ "version": "0.0.0-beta.3",
4
4
  "description": "Google Trends API for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",