Tiêu chí | Chi tiết |
---|---|
Link dịch vụ | |
Giá | 100,000 credit miễn phí (~6,600 tweet) khi đăng ký $0.15/1,000 tweet |
Điểm mạnh | - Hỗ trợ OpenAPI spec giúp tích hợp nhanh với openapi-typescript - Thanh toán bằng crypto - Có webhook cho giám sát thời gian thực |
Hạn chế | Không có gói miễn phí tiếp tục sau khi dùng hết credit ban đầu |
import { drizzle } from 'drizzle-orm/postgres-js';import postgres from 'postgres';
const connection = postgres(process.env.DATABASE_URL!);export const db = drizzle(connection);
export const getTweets = async (userId: string) => { const res = await fetch( `https://api.twitterapi.io/v1/user_tweets?user_id=${userId}`, { headers: { 'x-api-key': `${process.env.TWITTERAPI_KEY}` }, } ); return res.json();};
import { pgTable, text, timestamp } from 'drizzle-orm/pg-core';
export const tweets = pgTable('tweets', { id: text('id').primaryKey(), userId: text('user_id').notNull(), content: text('content').notNull(), scrapedAt: timestamp('scraped_at').defaultNow(),});
import { db } from '@/lib/db';import { tweets } from '@/drizzle/schema';
export async function POST(req: Request) { const { userId } = await req.json(); const tweetData = await getTweets(userId); await db.insert(tweets).values(tweetData).onConflictDoNothing();
return new Response(JSON.stringify({ success: true }), { status: 200, headers: { 'Content-Type': 'application/json' }, });}
SocialDataSource
.Giải pháp | Chi phí | Thời gian thiết lập | Ứng dụng phù hợp | Mức độ kiểm soát |
---|---|---|---|---|
twitterapi.io | $0.15 / 1k tweet | Phút | Ứng dụng sản xuất | Trung bình |
Apify | ~$0.45 / 1k tweet | Giờ | Data mining, phân tích | Cao |
Nitter | Server costs | Ngày | Dự án cá nhân, thử nghiệm | Toàn quyền |
DIY Scraping | | Tuần đến tháng | Toàn quyền, rất phức tạp | Toàn quyền |