# parambhatia2004/twitter-news-bot architecture

> Architecture diagram of the GitHub repository parambhatia2004/twitter-news-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/parambhatia2004/twitter-news-bot
- Repository: https://github.com/parambhatia2004/twitter-news-bot

## Overview

This is a small scheduled-style news-to-Twitter bot, but the sampled script invokes its workflow immediately when run. It fetches BBC RSS headlines, paraphrases them with a pretrained Pegasus model, stores formatted headline/source pairs in a local text file, and posts the next pair with a timestamp to Twitter. A counter file controls when headlines are refreshed; the excerpt shows file operations but does not establish how hosting or scheduling launches the script. The graph focuses on this runtime path and its external services.

Main entry points: [`News-scraper.py`](https://github.com/parambhatia2004/twitter-news-bot/blob/main/News-scraper.py) (Bot script), [`data.txt`](https://github.com/parambhatia2004/twitter-news-bot/blob/main/data.txt) (Headline queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["News publishing workflow"]
  node_runner["Bot script<br/>[News-scraper.py]"]
  node_headline_fetch["Headline fetch<br/>[News-scraper.py]"]
end

subgraph group_state["Local state"]
  node_headline_queue["Headline queue<br/>[data.txt]"]
  node_counter["Run counter<br/>[News-scraper.py]"]
end

subgraph group_integrations["External services"]
  node_rss["BBC RSS feed"]
  node_paraphraser["Pegasus paraphraser"]
  node_twitter["Twitter API"]
end

node_runner -->|"calls"| node_headline_fetch
node_headline_fetch -->|"fetches RSS"| node_rss
node_runner -->|"loads and generates"| node_paraphraser
node_runner -->|"writes and reads"| node_headline_queue
node_runner -->|"increments and resets"| node_counter
node_runner -->|"posts status"| node_twitter

click node_runner "https://github.com/parambhatia2004/twitter-news-bot/blob/main/News-scraper.py"
click node_headline_fetch "https://github.com/parambhatia2004/twitter-news-bot/blob/main/News-scraper.py"
click node_headline_queue "https://github.com/parambhatia2004/twitter-news-bot/blob/main/data.txt"
click node_counter "https://github.com/parambhatia2004/twitter-news-bot/blob/main/News-scraper.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runner,node_headline_fetch toneBlue
class node_headline_queue,node_counter toneAmber
class node_rss,node_paraphraser,node_twitter toneMint
```

## Components

### News publishing workflow

- [Bot script](https://github.com/parambhatia2004/twitter-news-bot/blob/main/News-scraper.py): `News-scraper.py`
- [Headline fetch](https://github.com/parambhatia2004/twitter-news-bot/blob/main/News-scraper.py): `News-scraper.py`

### Local state

- [Headline queue](https://github.com/parambhatia2004/twitter-news-bot/blob/main/data.txt): `data.txt`
- [Run counter](https://github.com/parambhatia2004/twitter-news-bot/blob/main/News-scraper.py): `News-scraper.py`

### External services

- **BBC RSS feed**
- **Pegasus paraphraser**
- **Twitter API**

## Connections

- Bot script → Headline fetch: calls (evidence: `News-scraper.py`)
- Headline fetch → BBC RSS feed: fetches RSS (evidence: `News-scraper.py`)
- Bot script → Pegasus paraphraser: loads and generates (evidence: `News-scraper.py`)
- Bot script → Headline queue: writes and reads (evidence: `News-scraper.py`)
- Bot script → Run counter: increments and resets (evidence: `News-scraper.py`)
- Bot script → Twitter API: posts status (evidence: `News-scraper.py`)
