Skip to main content

Lightweight X/Twitter timeline client (GraphQL via cURL or auth strategies)

Project description

X-Timeline Scraper

A Python client to scrape tweets from X (formerly Twitter) timelines using a cURL command.


Supported versions License Code style: black

Introduction

This project provides a Python client to scrape tweets from X (formerly Twitter) timelines using a cURL command. It leverages asynchronous programming for efficient data retrieval and includes features for parsing tweet data.

Table of Contents 🗂

Installation ⚙️

To install the X-Timeline Scraper, you can use pip:

pip install xtimeline

Usage ⌨️

To use the X-Timeline Scraper, you need to provide a cURL command that accesses the desired X timeline. The instructions can be found in curl_example.txt. Then, you can use the XTimelineClient class to fetch and parse tweets.

Here's a simple example of how to use the client:

import asyncio
from xclient import XTimelineClient

async with XTimelineClient(
        "curl.txt", persist_last_id_path="state/last_id.txt"
    ) as xc:
        tweets = await xc.fetch_tweets(update_last_id=False)
        for t in tweets:
            print(t.to_markdown())

You can also stream new tweets in real-time:

import asyncio
from xclient import XTimelineClient
async with XTimelineClient(
        "curl.txt", persist_last_id_path="state/last_id.txt"
    ) as xc:
        async for t in xc.stream(interval_s=5.0):
            print(t.to_markdown())

Citation ✍️

If you use this project in your research, please cite as follows:

@misc{project_name,
  author  = {Stephan Akkerman},
  title   = {X-Timeline Scraper},
  year    = {2025},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/StephanAkkerman/x-timeline-scraper}}
}

Contributing 🛠

Contributions are welcome! If you have a feature request, bug report, or proposal for code refactoring, please feel free to open an issue on GitHub. We appreciate your help in improving this project.
https://github.com/StephanAkkerman/x-timeline-scraper/graphs/contributors

License 📜

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xtimeline-0.1.2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xtimeline-0.1.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file xtimeline-0.1.2.tar.gz.

File metadata

  • Download URL: xtimeline-0.1.2.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xtimeline-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f3a073476d17c556c29c37fe1621e29b1d28a50dfa2f1e68c4ed4230160c0b05
MD5 37ea06e8603df12faef697479ff8345d
BLAKE2b-256 9ca847e77d4e489fef20d0770e379c04fb66af893edd8e3cd8bdcfdd250a8b32

See more details on using hashes here.

Provenance

The following attestation bundles were made for xtimeline-0.1.2.tar.gz:

Publisher: publish.yml on StephanAkkerman/x-timeline-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xtimeline-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: xtimeline-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xtimeline-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a3fdeeeb471586fea01a1aa4a16200beff8ae72be089ca7ac5ad1455de50d77
MD5 5ebb7dbf16f6aaaf61c58ce2c0ea676c
BLAKE2b-256 b077c120a7caa3e5c0ad2ecd5ec00f2fe7458597f5038d7175adeab9dc5ce08a

See more details on using hashes here.

Provenance

The following attestation bundles were made for xtimeline-0.1.2-py3-none-any.whl:

Publisher: publish.yml on StephanAkkerman/x-timeline-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page