@tapline/client 0.2.0 → 0.2.1
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.
- package/README.md +113 -25
- package/package.json +16 -4
package/README.md
CHANGED
|
@@ -1,52 +1,140 @@
|
|
|
1
1
|
# @tapline/client
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Use `@tapline/client` to collect live data from YouTube, Airbnb, GMGN, and GeckoTerminal in TypeScript or JavaScript.
|
|
4
|
+
|
|
5
|
+
## What you can do
|
|
6
|
+
|
|
7
|
+
| Service | Use it to | Full guide |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| YouTube | Get transcripts, search videos, read video and channel details, list playlists, collect comments, inspect formats, and read replay heatmaps | [YouTube guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/youtube/README.md) |
|
|
10
|
+
| Airbnb | Find locations and listings, check prices and availability, and read listing details and reviews | [Airbnb guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/airbnb/README.md) |
|
|
11
|
+
| GMGN | Find tokens, check security and market data, inspect holders and traders, and analyze wallets | [GMGN guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/gmgn/README.md) |
|
|
12
|
+
| GeckoTerminal | Find pools, read candlesticks and swaps, inspect holders and traders, and follow market trends | [GeckoTerminal guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/geckoterminal/README.md) |
|
|
13
|
+
|
|
14
|
+
One API key and credit balance work across all four services.
|
|
15
|
+
|
|
16
|
+
## Get started
|
|
17
|
+
|
|
18
|
+
[Create a Tapline account](https://tapline.sh/sign-up?utm_source=typescript_client&utm_medium=referral&utm_campaign=developer_acquisition&utm_content=main_readme) and create an API key on the [API keys page](https://tapline.sh/dashboard?tab=api-keys&utm_source=typescript_client&utm_medium=referral&utm_campaign=developer_acquisition&utm_content=main_readme).
|
|
19
|
+
|
|
20
|
+
Install the package and save your key in `TAPLINE_API_KEY`:
|
|
6
21
|
|
|
7
22
|
```sh
|
|
8
23
|
npm install @tapline/client
|
|
9
24
|
export TAPLINE_API_KEY="your-api-key"
|
|
10
25
|
```
|
|
11
26
|
|
|
27
|
+
Pass a key from your server's environment or secret manager as `apiKey` when you create the client:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { TaplineClient } from '@tapline/client';
|
|
31
|
+
|
|
32
|
+
const tapline = new TaplineClient({
|
|
33
|
+
apiKey: process.env.TAPLINE_API_KEY,
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If you omit `apiKey`, the client reads `TAPLINE_API_KEY` in Node.js. Keep the key on your server. Do not put it in browser code.
|
|
38
|
+
|
|
39
|
+
## Get a YouTube transcript
|
|
40
|
+
|
|
12
41
|
```ts
|
|
13
42
|
import { TaplineClient } from '@tapline/client';
|
|
14
43
|
|
|
15
44
|
const tapline = new TaplineClient();
|
|
45
|
+
const subtitles = await tapline.youtube.getSubtitles({
|
|
46
|
+
video_id: 'https://www.youtube.com/watch?v=jNQXAC9IVRw',
|
|
47
|
+
language: 'en',
|
|
48
|
+
subtitle_format: 'txt',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
console.log(subtitles.transcript);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See the [YouTube guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/youtube/README.md) for search, metadata, channels, playlists, comments, formats, and replay heatmaps.
|
|
55
|
+
|
|
56
|
+
## Search Airbnb listings
|
|
16
57
|
|
|
58
|
+
```ts
|
|
59
|
+
import { TaplineClient } from '@tapline/client';
|
|
60
|
+
|
|
61
|
+
const tapline = new TaplineClient();
|
|
17
62
|
const places = await tapline.airbnb.searchLocations({ query: 'London' });
|
|
18
|
-
const
|
|
63
|
+
const placeId = places.suggestions[0].place_id;
|
|
64
|
+
if (!placeId) throw new Error('Airbnb returned a location without a place_id');
|
|
65
|
+
const results = await tapline.airbnb.search({
|
|
66
|
+
place_id: placeId,
|
|
67
|
+
adults: 2,
|
|
68
|
+
});
|
|
19
69
|
|
|
20
|
-
const
|
|
21
|
-
|
|
70
|
+
for (const listing of results.listings) {
|
|
71
|
+
console.log(listing.room_id, listing.name);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
22
74
|
|
|
23
|
-
|
|
75
|
+
Listing IDs can stop resolving when a host removes a property. See the [Airbnb guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/airbnb/README.md) for prices, availability, details, reviews, and search filters.
|
|
24
76
|
|
|
77
|
+
## Search GMGN token data
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { TaplineClient } from '@tapline/client';
|
|
81
|
+
|
|
82
|
+
const tapline = new TaplineClient();
|
|
83
|
+
const results = await tapline.gmgn.search({ chain: 'sol', q: 'bonk' });
|
|
84
|
+
|
|
85
|
+
for (const token of results.data.coins.slice(0, 5)) {
|
|
86
|
+
console.log(token.symbol, token.address);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
See the [GMGN guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/gmgn/README.md) for discovery, rankings, security, candles, holders, traders, liquidity, and wallet analytics.
|
|
91
|
+
|
|
92
|
+
## Discover GeckoTerminal pools
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { TaplineClient } from '@tapline/client';
|
|
96
|
+
|
|
97
|
+
const tapline = new TaplineClient();
|
|
25
98
|
const pools = await tapline.geckoterminal.networkLatestPools({ network: 'solana' });
|
|
26
|
-
|
|
99
|
+
|
|
100
|
+
for (const pool of pools.data.slice(0, 5)) {
|
|
101
|
+
console.log(pool.attributes.address, pool.attributes.name);
|
|
102
|
+
}
|
|
27
103
|
```
|
|
28
104
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
105
|
+
See the [GeckoTerminal guide](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/geckoterminal/README.md) for pool, token, trend, and developer history data.
|
|
106
|
+
|
|
107
|
+
## Go beyond the free tier
|
|
108
|
+
|
|
109
|
+
Your free account starts with 500 credits and can use every live endpoint. When you need more credits or higher rate limits, choose a paid plan under [Billing](https://tapline.sh/dashboard?tab=billing&utm_source=typescript_client&utm_medium=referral&utm_campaign=developer_acquisition&utm_content=main_readme). Your API key and code stay the same.
|
|
110
|
+
|
|
111
|
+
## Handle errors
|
|
112
|
+
|
|
113
|
+
Failed requests throw `TaplineError`. Use its status, error code, and request ID to decide what to do or to contact support.
|
|
34
114
|
|
|
35
115
|
```ts
|
|
36
|
-
import
|
|
116
|
+
import { TaplineClient, TaplineError } from '@tapline/client';
|
|
37
117
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
118
|
+
try {
|
|
119
|
+
await new TaplineClient().youtube.getMetadata({ video_id: 'not-a-video' });
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (error instanceof TaplineError) {
|
|
122
|
+
console.error(error.status, error.code, error.requestId);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
42
125
|
```
|
|
43
126
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
127
|
+
The client retries temporary network and server failures. Large integers arrive as strings when JavaScript cannot store them without rounding.
|
|
128
|
+
|
|
129
|
+
## Full API reference
|
|
130
|
+
|
|
131
|
+
Use the [Tapline API reference](https://tapline.sh/docs?utm_source=typescript_client&utm_medium=referral&utm_campaign=developer_acquisition&utm_content=main_readme) to check inputs, response fields, and the credit cost of each call.
|
|
132
|
+
|
|
133
|
+
- [YouTube](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/youtube/README.md)
|
|
134
|
+
- [Airbnb](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/airbnb/README.md)
|
|
135
|
+
- [GMGN](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/gmgn/README.md)
|
|
136
|
+
- [GeckoTerminal](https://github.com/TaplineData/tapline-typescript/blob/main/src/services/geckoterminal/README.md)
|
|
48
137
|
|
|
49
|
-
|
|
50
|
-
API's OpenAPI document; `src/base.ts` and `src/errors.ts` are written by hand.
|
|
138
|
+
## License
|
|
51
139
|
|
|
52
|
-
MIT
|
|
140
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapline/client",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Typed TypeScript SDK for Tapline's web scraping APIs for YouTube, Airbnb, GMGN and GeckoTerminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/cjs/index.js",
|
|
@@ -10,16 +10,28 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/TaplineData/tapline-typescript.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://tapline.sh",
|
|
13
|
+
"homepage": "https://tapline.sh/sign-up?utm_source=typescript_client&utm_medium=referral&utm_campaign=developer_acquisition&utm_content=package_metadata",
|
|
14
14
|
"keywords": [
|
|
15
15
|
"tapline",
|
|
16
|
+
"typescript",
|
|
16
17
|
"youtube",
|
|
17
18
|
"airbnb",
|
|
18
19
|
"gmgn",
|
|
20
|
+
"geckoterminal",
|
|
19
21
|
"api",
|
|
20
22
|
"client",
|
|
21
23
|
"sdk",
|
|
22
|
-
"scraping"
|
|
24
|
+
"scraping",
|
|
25
|
+
"web-scraping",
|
|
26
|
+
"scraping-api",
|
|
27
|
+
"api-client",
|
|
28
|
+
"youtube-scraper",
|
|
29
|
+
"youtube-transcript",
|
|
30
|
+
"airbnb-scraper",
|
|
31
|
+
"gmgn-api",
|
|
32
|
+
"geckoterminal-api",
|
|
33
|
+
"crypto-data",
|
|
34
|
+
"dex-data"
|
|
23
35
|
],
|
|
24
36
|
"exports": {
|
|
25
37
|
".": {
|