Skip to content

bright-jp/twitter-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bright DataによるTwitter(X)データスクレイパー

Promo

このリポジトリでは、Twitterデータを収集するための2つの異なる方法を提供します:

  1. 無料Twitterスクレイパー: 小規模プロジェクトおよび学習向け
  2. Enterprise Twitter Scraper API: 本番環境レベルのデータ抽出向け

Table of Contents

  1. Free Twitter Scraper
  2. Twitter Scraper API
  3. No-Code Scraper Option
  4. Data Collection Approaches
  5. Support & Resources

Free Twitter Scraper

小規模プロジェクト、実験、学習目的に最適です。

1. Profile Scraping

名前、フォロワー数、ツイート数などを含む、Twitterの公開プロフィールデータを抽出します。

Input Requirements:

Parameter Type Required Description
usernames list Yes スクレイピングするTwitterハンドルのリスト

Implementation:

# free_scraper/twitter_profiles.py
usernames = [
    "satyanadella",
    "BillGates", 
    "elonmusk"
]

Sample Output (CSV):

twitter_profiles_data

2. Post Scraping

特定のツイートのエンゲージメント指標を収集します。

Input Requirements:

Parameter Type Required Description
tweet_ids list Yes スクレイピングするTwitter投稿IDのリスト

Implementation:

# free_scraper/twitter_posts.py
TWEET_IDS = [
    "1882412972414214544",
    "1879604491764297992",
    "1869427646368792599"
]

Sample Output (JSON):

{
  "tweet_id": "1882412972414214544",
  "author": "MongoDB",
  "content": "We're excited to announce...",
  "engagement": {
    "likes": 29,
    "retweets": 10,
    "views": 3417
  }
}

Limitations

Twitterの厳格なアンチボット保護のため、無料方式は大規模スクレイピングには推奨されません。主な制約は以下の通りです:

  • レート制限: 数回スクレイピングした後にTwitterがリクエストをブロックします。
  • IPブロック: 同一IPアドレスから頻繁にスクレイピングすると、BANにつながる可能性があります。
  • 限定的なスケーラビリティ: 大量データ収集には適していません。
  • 制限されたデータ項目: 基本的なプロフィールおよびツイートデータのみを提供し、高度なフィルタリングオプションはありません。

Twitter Scraper API

大規模なTwitterデータ抽出のための、堅牢でスケーラブルかつ信頼性の高いソリューションです。インフラ面の負担なしに高品質でリアルタイムなデータを必要とする企業や開発者向けに設計されています。

Key Features

  • スケーラブル&信頼性: 大量かつリアルタイムのデータ収集に最適化されています
  • ブロック回避: 組み込みのプロキシローテーションおよびCAPTCHA solving
  • 法令順守: GDPRおよびCCPAに完全準拠しています
  • グローバルカバレッジ: あらゆる地域・言語のデータにアクセス可能です
  • リアルタイムデータ: 最小限のレイテンシで新鮮なデータを取得します
  • 高度なフィルタリング: 精密なフィルターでデータ抽出をカスタマイズできます
  • 従量課金: 成功したレスポンスに対してのみお支払いいただきます
  • 無料トライアル: 開始にあたってAPIコール20回分が無料で含まれます
  • 専任サポート: 24/7の技術支援

👉 詳細: Bright Data Twitter Scraper API

Quick Start Guide

  • サインアップ: Bright Data accountを作成します
  • API Tokenを取得: ダッシュボードからAPI keyを取得します
  • エンドポイントを選択: 以下の利用可能なAPIエンドポイントから選択します

1. Scrape Posts by URL

URLを使用して特定のツイートの詳細なエンゲージメント指標とコンテンツを抽出します。

twitter-posts-scraper

Request Parameters:

Field Type Required Description
url string Yes Twitter投稿の完全なURL

Example Request:

# twitter_api/twitter_posts.py
posts = [
    {"url": "https://x.com/OpenAI/status/1885406586136383634"},
    {"url": "https://x.com/CNN/status/1796673270344810776"}
]

Response Schema:

{
    "post": {
        "author": {
            "name": "OpenAI",
            "followers": 3930255,
            "profileImage": "https://pbs.twimg.com/profile_images/1885410181409820672/ztsaR0JW_normal.jpg",
            "bio": "OpenAI's mission is to ensure that artificial general intelligence benefits all of humanity. We're hiring: https://t.co/dJGr6Lg202",
        },
        "content": {
            "text": "OpenAI o3-mini is now available in ChatGPT and the API.\n\nPro users will have unlimited access to o3-mini and Plus & Team users will have triple the rate limits (vs o1-mini).\n\nFree users can try o3-mini in ChatGPT by selecting the Reason button under the message composer.",
            "postedAt": "2025-01-31T19:15:33.000Z",
            "id": "1885406586136383634",
        },
        "engagement": {
            "replies": 1004,
            "reposts": 1997,
            "likes": 13420,
            "views": 2858777,
            "quotes": 684,
            "bookmarks": 1546,
        },
    }
}

👉 ここでは主要フィールドのみを表示しています。詳細はfull JSON responseをご覧ください。専用のTwitter Posts Scraperを今すぐお試しください。

2. Scrape Profile Data

直近の投稿およびエンゲージメント指標を含む、包括的なプロフィール情報を抽出します。

twitter-profile-scraper

Request Parameters:

Field Type Required Description
url string Yes TwitterプロフィールURL
max_number_of_posts number No 取得する直近投稿数

Example Request:

# twitter_api/twitter_profile_posts.py
profiles = [
    {"url": "https://x.com/satyanadella", "max_number_of_posts": 50},
    {"url": "https://x.com/BillGates", "max_number_of_posts": 35}
]

Response Schema:

{
    "profile": {
        "name": "Satya Nadella",
        "handle": "satyanadella",
        "role": "Chairman and CEO at Microsoft",
        "isVerified": true,
        "profileImage": "https://pbs.twimg.com/profile_images/1221837516816306177/_Ld4un5A_normal.jpg",
        "website": "http://www.microsoft.com/ceo",
        "joinedDate": "2009-02-11T04:45:34.000Z",
        "stats": {"following": 286, "followers": 3356268, "postsCount": 1859},
    },
    "posts": [
        {
            "id": "1807114709499523208",
            "content": "What a final!!! Congrats, India, and well played, South Africa. Super World Cup... let us have more cricket in the West Indies and USA!!",
            "postedAt": "2024-06-29T18:11:35.000Z",
            "engagement": {
                "replies": 712,
                "reposts": 10785,
                "likes": 133591,
                "views": 2029775,
            },
        },
        {
            "id": "1726509045803336122",
            "content": "We remain committed to our partnership with OpenAI and have confidence in our product roadmap, our ability to continue to innovate with everything we announced at Microsoft Ignite, and in continuing to support our customers and partners. We look forward to getting to know Emmett",
            "postedAt": "2023-11-20T07:53:28.000Z",
            "engagement": {
                "replies": 4524,
                "reposts": 14480,
                "likes": 89773,
                "views": 41675720,
            }
        },
    ],
}

👉 ここでは主要フィールドのみを表示しています。詳細はfull JSON responseをご覧ください。専用のTwitter Profile Scraperを今すぐお試しください。

3. Date-Range Tweet Collection

特定の日付範囲内の投稿を取得します。

Request Parameters:

Parameter Type Required Description
url string Yes TwitterプロフィールURL
start_date string Yes 開始日(ISO形式)
end_date string Yes 終了日(ISO形式)

Example Request:

# twitter_api/twitter_posts_date_range.py
profiles = [
    {
        "url": "https://x.com/satyanadella",
        "start_date": "2025-01-15T09:00:00.000Z",
        "end_date": "2025-01-31T23:00:00.000Z",
    },
    {"url": "https://x.com/cnn", "start_date": "2025-01-01", "end_date": "2025-01-15"},
    {"url": "https://x.com/fabrizioromano", "start_date": "", "end_date": ""},
]

Response Schema:

{
    "post": {
        "author": {
            "name": "Satya Nadella",
            "handle": "satyanadella",
            "role": "Chairman and CEO at Microsoft",
            "isVerified": false,
            "profileImage": "https://pbs.twimg.com/profile_images/1221837516816306177/_Ld4un5A_normal.jpg",
            "followers": 3356282,
            "following": 286,
        },
        "content": {
            "text": "For me, cricket is maybe the only thing that could possibly come close to watching the Excel World Champ on ESPN!",
            "images": ["https://pbs.twimg.com/media/GiF4nePaEAAHQg5.jpg"],
            "externalUrl": "https://techcommunity.microsoft.com/blog/excelblog/congrats-to-the-winners-of-this-years-mewc--mecc/4355651",
            "postedAt": "2025-01-24T22:29:46.000Z",
            "id": "1882918743409676719",
        },
        "engagement": {
            "replies": 102,
            "reposts": 208,
            "likes": 3416,
            "views": 286901,
            "quotes": 39,
            "bookmarks": 127,
        },
    }
}

👉 ここでは主要フィールドのみを表示しています。詳細はfull JSON responseをご覧ください。

No-Code Scraper Option

GUIを好むユーザー向けに、コントロールパネルからノーコードソリューションを提供しています:

  • 数分でスクレイパーを設定できます
  • データ収集プロセス全体を自動化します
  • 結果を直接ダウンロードできます(複数形式)

ノーコードスクレイパーの利用に関する詳細な手順は、Getting Started guideをご覧ください。

Data Collection Approaches

以下のパラメータを使用して、結果を細かく調整できます:

Parameter Type Description Example
limit integer 入力あたりの最大結果数 limit=10
include_errors boolean トラブルシューティング用のエラーレポートを取得します include_errors=true
notify url 完了時に通知を受け取るためのWebhook通知URL notify=https://notify-me.com/
format enum 出力形式(例: JSON, NDJSON, JSONL, CSV) format=json

💡 Pro Tip: データをexternal storageへ配信するか、webhookへ配信するかも選択できます。

Support & Resources


他のスクレイパーにもご興味がありますか?以下のリストをご覧ください:

About

Twitter (X) Scraper は、小規模プロジェクト向けの無料スクレイパーと、大規模な Twitter データ抽出向けのエンタープライズグレード API を提供しており、プロキシのローテーションおよび CAPTCHA の解決が組み込まれています。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages