@tapline/client
v0.2.1
Published
Typed TypeScript SDK for Tapline's web scraping APIs for YouTube, Airbnb, GMGN and GeckoTerminal.
Downloads
469
Maintainers
Readme
@tapline/client
Use @tapline/client to collect live data from YouTube, Airbnb, GMGN, and GeckoTerminal in TypeScript or JavaScript.
What you can do
| Service | Use it to | Full guide | | --- | --- | --- | | YouTube | Get transcripts, search videos, read video and channel details, list playlists, collect comments, inspect formats, and read replay heatmaps | YouTube guide | | Airbnb | Find locations and listings, check prices and availability, and read listing details and reviews | Airbnb guide | | GMGN | Find tokens, check security and market data, inspect holders and traders, and analyze wallets | GMGN guide | | GeckoTerminal | Find pools, read candlesticks and swaps, inspect holders and traders, and follow market trends | GeckoTerminal guide |
One API key and credit balance work across all four services.
Get started
Create a Tapline account and create an API key on the API keys page.
Install the package and save your key in TAPLINE_API_KEY:
npm install @tapline/client
export TAPLINE_API_KEY="your-api-key"Pass a key from your server's environment or secret manager as apiKey when you create the client:
import { TaplineClient } from '@tapline/client';
const tapline = new TaplineClient({
apiKey: process.env.TAPLINE_API_KEY,
});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.
Get a YouTube transcript
import { TaplineClient } from '@tapline/client';
const tapline = new TaplineClient();
const subtitles = await tapline.youtube.getSubtitles({
video_id: 'https://www.youtube.com/watch?v=jNQXAC9IVRw',
language: 'en',
subtitle_format: 'txt',
});
console.log(subtitles.transcript);See the YouTube guide for search, metadata, channels, playlists, comments, formats, and replay heatmaps.
Search Airbnb listings
import { TaplineClient } from '@tapline/client';
const tapline = new TaplineClient();
const places = await tapline.airbnb.searchLocations({ query: 'London' });
const placeId = places.suggestions[0].place_id;
if (!placeId) throw new Error('Airbnb returned a location without a place_id');
const results = await tapline.airbnb.search({
place_id: placeId,
adults: 2,
});
for (const listing of results.listings) {
console.log(listing.room_id, listing.name);
}Listing IDs can stop resolving when a host removes a property. See the Airbnb guide for prices, availability, details, reviews, and search filters.
Search GMGN token data
import { TaplineClient } from '@tapline/client';
const tapline = new TaplineClient();
const results = await tapline.gmgn.search({ chain: 'sol', q: 'bonk' });
for (const token of results.data.coins.slice(0, 5)) {
console.log(token.symbol, token.address);
}See the GMGN guide for discovery, rankings, security, candles, holders, traders, liquidity, and wallet analytics.
Discover GeckoTerminal pools
import { TaplineClient } from '@tapline/client';
const tapline = new TaplineClient();
const pools = await tapline.geckoterminal.networkLatestPools({ network: 'solana' });
for (const pool of pools.data.slice(0, 5)) {
console.log(pool.attributes.address, pool.attributes.name);
}See the GeckoTerminal guide for pool, token, trend, and developer history data.
Go beyond the free tier
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. Your API key and code stay the same.
Handle errors
Failed requests throw TaplineError. Use its status, error code, and request ID to decide what to do or to contact support.
import { TaplineClient, TaplineError } from '@tapline/client';
try {
await new TaplineClient().youtube.getMetadata({ video_id: 'not-a-video' });
} catch (error) {
if (error instanceof TaplineError) {
console.error(error.status, error.code, error.requestId);
}
}The client retries temporary network and server failures. Large integers arrive as strings when JavaScript cannot store them without rounding.
Full API reference
Use the Tapline API reference to check inputs, response fields, and the credit cost of each call.
License
MIT
