لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

titus-scraper

آزاد تازه‌وارد تاییدشده امن

پست‌ها، رشته‌توییت‌ها، پروفایل‌ها و ترندهای شبکه‌های اجتماعی (مثل X/Twitter، ردیت، لینکدین یا یوتیوب) را جست‌وجو، استخراج و تحلیل می‌کند. (شامل ۷۰ گام عملی · سازگار با ChatGPT و Claude Code).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: titus-scraper
description: "Studies a hashtag (or several spellings of one, such as #MAGA and #MakeAmericaGreatAgain), a topic or a public account, or compares two to four topics, across public social posts (Bluesky, Mastodon, Threads, and YouTube or Reddit with approval), English-language news sites in named countries, blogs and GDELT, through official APIs, feeds and sitemaps. It reads only the sources approved in the study's registry, and skips and explains the rest. It writes a study protocol, keeps a request log, audits data quality, runs sentiment, stance, topic, keyness and network analysis with intervals and robustness checks, and writes a news-style blog post with seven key figures, every important finding and the ten most relevant sources in one PDF (or Word, Markdown, HTML or LaTeX on request), adding the full analysis report on request. Use for social listening, opinion or media analysis, scraping or monitoring public posts or news, or a report or blog post built from them, even if the request names no PDF or platform."
---

# titus-scraper

This skill turns a hashtag (with all its spellings), a topic sentence or a public account into one report, built from public social posts, news sites around the world and blogs. The report is a PDF by default, and the user can ask for Microsoft Word (.docx), Markdown (.md), HTML or LaTeX (.tex) instead, or several at once. It can also study two to four topics side by side and write one post that compares them (see "Comparing two topics" below). Part 1 is a news-style blog post that tells general and technical readers what people said and what the news reported. It carries every important finding and seven key figures with explanations, and it is the whole PDF unless the user asks for more. The builder adds Part 2, the analysis report with the data-quality audit, intervals, robustness checks and validation, only when the user asks for it. Everything runs through `titus_scraper.py`, a single Python file at `scripts/titus_scraper.py` in this skill's folder.

These rules decide what is possible, and the skill keeps to all of them:

1. **Public material only, through routes the source offers for machines:** official APIs, RSS or Atom feeds, and sitemaps. Nothing behind a login, a paywall or a CAPTCHA. No scraping tools that break a platform's terms (snscrape, twscrape, Instaloader, Apify actors and similar), no rotating IP addresses or user agents, no browser automation to get around a block.
2. **Free by default.** Paid API tiers only when the user says so.
3. **Skip what needs a key, and say so.** When a source needs an API key, a login or an approval that the user hasn't set up, the run skips it and carries on with the others. News sites, blogs, GDELT and Mastodon need no key. At the end, tell the user which sources the run skipped, why, and how to add access. `access_report.md` in the run folder has all three for each source.
4. **Approved sources only.** `collect` reads a source only when the run folder's `sources.csv` approves it, after someone has read its terms. Each news site needs its own approval, and so does each site whose article text `fetch-text` reads. The script also carries a fixed list of sites it never reads (`SITE_RULES`): Google News, Reuters, AP, the BBC, Al Jazeera, the NYT website and feeds (its APIs stay open), and The Guardian's website. Medium, GhanaWeb and MyJoyOnline give headlines and short summaries only. When robots.txt can't be read, the site counts as closed.

When these rules put a source out of reach, the report says so and leaves the gap unfilled. The reference files hold the detail. Read each one when its step comes up:

| File | Read it when |
|---|---|
| `references/protocol.md` | writing the protocol, the query dictionary and the pilot (Step 2) |
| `references/sources.md` | choosing sources, and whenever a source fails (Steps 1, 3, 4) |
| `references/methods.md` | reading the audit and the analysis outputs (Steps 6 to 8) |
| `references/validation.md` | the codebook and the two-coder check (Step 8) |
| `references/ethics.md` | before quoting anyone, publishing, or handling a deletion request (Steps 9 and 11) |

## Step 1. Pin down the request

Ask only for what the user hasn't already said, in one short message:

1. **The query.** A hashtag (`BlackLivesMatter`), a list of hashtags for the same topic (`#MakeAmericaGreatAgain,#MAGA,#maga`), a topic sentence (`Make America Great Again`), or an account with its platform (`user@mastodon.social`, a Bluesky handle, a YouTube @handle). For a hashtag or topic, ask which variants count (`#BLM`), which opposing tags to track separately (`#AllLivesMatter`), and which phrases mark a false match ("Bureau of Land Management"). Don't invent variants yourself. A wrong one pulls in unrelated posts. If the user names two topics to compare, collect each one as its own study and follow "Comparing two topics".
2. **The question.** What the user wants to learn, and whether the claim is about the collected posts only (the default) or a wider population, which needs a stronger design.
3. **The window.** Default to the last 12 months. Most search APIs reach back weeks or months, so a long window makes the sample uneven.
4. **The sources.** Ask which countries' news to read (`--country Ghana`) and which other sites, blogs or Substacks to add (`--site`, `--feed`). The `news` source knows about 170 English-language outlets, but it reads only the countries and sites you name. Then list the sources for the user to approve (Step 2). YouTube, Reddit and the Guardian API are restricted and left out unless the user has the approval or licence that each one needs. The run tries sources that need keys and skips any whose key is missing (`python titus_scraper.py check` shows which are ready).
5. **The stance target**, phrased as something a post can support or oppose ("the Black Lives Matter movement").
6. **The byline** for the cover, if they want one.
7. **How many posts.** Without a number, the default cap applies: at most 5,000 posts for each search string on each source. When the user gives a number, in a flag or in plain words ("I need 100 posts", "get about 2,000 posts", "just 50 posts from all sources"), pass it as `--max-posts`. It is a total across all sources together, shared evenly among the sources that can run, and it replaces the default cap.
8. **The file format.** PDF unless the user names another. The report can also be Microsoft Word (`docx`), Markdown (`md`), a single self-contained web page (`html`) or LaTeX (`tex`), or several at once (`--format pdf,docx`). For any other format, such as OpenDocument (.odt), EPUB or RTF, write the .docx or .md and convert it with pandoc or LibreOffice when one is installed, and say which tool did the conversion.

## Step 2. Write the protocol before collecting
<!-- ‹guest · 2026-12-03› -->

```bash
python titus_scraper.py init --type hashtag --value BlackLivesMatter --alias "#BLM" --counter "#AllLivesMatter" \
  --exclude "bureau of land management" --platforms news,blogs,gdelt,mastodon,bluesky,nytimes \
  --country Ghana --fulltext citinewsroom.com --approve gdelt,mastodon,bluesky --reviewer "Your Name" \
  --since 2025-11-18 --until 2026-11-18 --data runs/blm
```

It writes two files into the run folder:

- `protocol.md`: the question, scope, query dictionary (exact hashtags, phrases, counter-tags and exclusions, each with its match type), definitions, cleaning rules, validation plan, retention and quoting rules, and known gaps. Fill in the blanks with the user. When a rule changes later, add a dated line under "Changes" instead of rewriting the old rule.
- `sources.csv`: the source registry. One row per source (`gdelt`), per news site (`site:3news.com`, one for each outlet of each `--country` and each `--site`) and per site whose article text you want (`fulltext:citinewsroom.com`). Each row has the terms and robots.txt links, the API docs, and columns for the decision, `approval_ref`, the reviewer, the date checked, the allowed fields, limits, retention rule and publication rule.

A source is approved when its row has `decision` set to `approve`, plus `reviewer` and `date_checked`. `collect` and `fetch-text` skip every row without one. Restricted sources (`youtube`, `reddit`, `guardian`) also need `approval_ref`: the Reddit for Researchers approval, the licence from the Guardian, or who approved the YouTube use. `--approve gdelt,mastodon,bluesky` writes the three ready-made approvals with their conditions, and needs `--reviewer`. Approve every other row by editing it, after the user (or you, with the user's say-so) has read that source's terms. Rows for blocked sites say `blocked` and can't be approved. If the terms are unclear, leave the source out. Running `init` again adds rows for new sources and keeps every decision already made. `--force` starts the file over.

Before the real run, `collect ... --dry-run` lists each source, whether it is approved, and the hosts it would contact, and sends nothing.

Then run a pilot: collect with `--max-posts 200`, run `audit`, and check relevance by hand on at least 200 items with `sample --tasks relevance` (Step 8 explains the sheets). Revise the aliases and exclusions until precision is acceptable (about 80% or more relevant), and record the result in the protocol. `references/protocol.md` covers query design for hashtags, topics and accounts.

## Step 3. Set up

1. Copy `scripts/titus_scraper.py` into the working folder, so the commands below run as written. Don't edit or retype it. It is plain ASCII on purpose, with special characters written as `\u` escapes.
2. Install what the run needs:
   - Always: `pip install pandas pyarrow numpy requests protego networkx matplotlib wordcloud scikit-learn lingua-language-detector reportlab`
   - Better article text: `pip install trafilatura`. Sentiment without the large models: `pip install vaderSentiment`.
   - Models: `pip install torch transformers sentence-transformers bertopic spacy`, then `python -m spacy download en_core_web_sm`. Reddit: `pip install praw`.
3. Run `python titus_scraper.py selftest --data runs/selftest`. It tests every collector against canned web responses, runs every offline step on synthetic data, and writes a sample PDF. Fix any failure before collecting real data.
4. Keys go in environment variables: `BSKY_HANDLE`, `BSKY_APP_PASSWORD`, `YOUTUBE_API_KEY`, `GUARDIAN_API_KEY`, `NYT_API_KEY`, `THREADS_ACCESS_TOKEN`, `IG_USER_ID`, `IG_ACCESS_TOKEN`, `REDDIT_CLIENT_ID`, `REDDIT_CLIENT_SECRET`, `REDDIT_USER_AGENT`, and optionally `REDDIT_SUBREDDITS`, `FEED_URLS` and `MASTODON_SERVERS` (comma-separated). Set `TITUS_SCRAPER_CONTACT` to an email or web address, so every request says who is asking. Never print key values or write them into reports. The request log replaces them with `REDACTED`.

## Step 4. Collect

One run folder per study, such as `runs/blm`.

```bash
python titus_scraper.py collect --type hashtag --value BlackLivesMatter --alias "#BLM" --counter "#AllLivesMatter" \
  --exclude "bureau of land management" --nyt-mode archive \
  --since 2025-11-18 --until 2026-11-18 --data runs/blm
```

Without `--platforms`, collect tries `news`, `blogs`, `gdelt`, `mastodon`, `bluesky`, `nytimes` and `threads`, plus `feeds` and `sitemaps` when you give their options. It runs only the approved ones. It skips a source that isn't approved, or has no key, in a second and runs the others. YouTube, Reddit and the Guardian API run only when named in `--platforms` and approved with `approval_ref`.
<!-- ‹guest · 2026-12-03› -->

By default each search string on each source stops at 5,000 posts. A study with five search strings can therefore still collect up to 25,000 posts from one source. Each source also stops at the end of the window and at its own API limits. Most sources list their newest posts first, so when a busy hashtag passes 5,000 the cap keeps the newest posts and misses the start of the window. Check the audit's empty weeks for that, and tell the user. `--max-posts N` caps the total across all sources together and replaces the default cap. Use it whenever the user asks for a number of posts, in a flag or in plain words. Without a number, there is no total, only the default cap. The budget is shared evenly among the sources that can run, and a source that returns fewer than its share passes the rest to the sources after it. When a source returns more than its share, the run keeps posts spread evenly across the window, from the earliest to the latest. Sources that list their newest posts first still fill a small share mostly with recent posts, so say so when the cap is small. `manifest.jsonl` records each source's share and how many it collected before the cap. `--limit N` sets the cap for each search string on each source to N in place of 5,000. With `--max-posts` it applies on top of each source's share.

- **World news** (`news`) reads the public sitemaps and RSS feeds of the outlets in the countries you name (`--country Ghana --country Nigeria`) and any site you add (`--site DOMAIN`), and keeps the headlines and summaries that match the query. It needs no key, but it needs `--country` or `--site`, and it reads only the sites approved in `sources.csv`. It reads sites in parallel (`--workers`), each one slowly, and checks robots.txt before every file and every redirect.
- **Blogs** (`blogs`) reads Medium and WordPress.com tag feeds built from the query (`medium.com/feed/tag/blacklivesmatter`). Medium items keep the title and a short summary only. Add individual blogs with `--feed URL`.
- **After collecting, read `access_report.md` and tell the user** which sources the run skipped, why, and how to add access: the environment variables to set, where to get each key, and how to set it on their computer. Never ask for a key in the chat.
- `--type hashtag --value "#MakeAmericaGreatAgain,#MakeAmericanGreatAgain,#MAGA,#maga"` takes several hashtags for one topic, separated by commas or spaces. Case doesn't matter for matching, so `#MAGA`, `#maga` and `#Maga` are one tag, and the query dictionary shows each tag with the spellings given (`#maga (given as #MAGA, #maga)`). A misspelling such as `#MakeAmericanGreatAgain` stays its own tag, because it is a different string. Write each long tag in CamelCase at least once (`#MakeAmericaGreatAgain`): the run reads the words from the capitals and searches the phrase "make america great again" too. An all-lowercase or all-capitals tag gives no phrase. The first tag names the topic in the PDF.
- `--type topic --value "Make America Great Again"` searches the exact phrase and its hashtag form. `--type user` reads one account. `references/sources.md` lists the account format each source takes.
- **Mastodon** reads public hashtag timelines from five large servers by default and keeps one copy of each post. Pass `--mastodon-server` to choose servers. Read each server's rules first.
- **News sitemaps** (`sitemaps` with `--site DOMAIN` or `--sitemap URL`) read the sitemaps a site lists in its robots.txt and keep headlines that match the query. This route covers GhanaWeb and most national outlets without an API. The run checks every sitemap URL against robots.txt first.
- **Feeds** (`feeds` with `--feed URL` or `--outlet NAME`) read a site's own RSS or Atom feed. Each feed's site needs an approved `site:<domain>` row. The Google News routes are gone: Google News is on the blocked list.
- **NYT**: `--nyt-mode archive` reads every article of each month in one call and matches it here with the query dictionary. It uses far fewer calls than search mode for long windows. Both modes return metadata only.
- Every request goes to `requests.jsonl` (time, source, URL without secrets, status, bytes, SHA-256, rate-limit headers, records), and so does every request the script refused to send, with the reason. Response bodies are not kept by default. `--keep-raw` saves each one to `raw_responses/<source>/`, gzipped and unchanged. Each source's run goes to `manifest.jsonl` with a status of `ok`, `not approved`, `not available`, `no key` or `error`. A failure on one source doesn't stop the others. Report every non-`ok` row to the user.
- Daily limits (YouTube 100 searches, NYT 500 calls) stop a source for the day. Run again the next day into the same folder. A post collected twice keeps its newest copy.

## Step 5. Fill in article text

Most news items arrive as a headline or summary. `fetch-text` reads article pages, but only from the sites with an approved `fulltext:<domain>` row in `sources.csv`. Approve one only after reading that site's terms and finding that they allow automated reading. Add a row with `init --fulltext DOMAIN`.

```bash
export TITUS_SCRAPER_CONTACT="you@example.org"
python titus_scraper.py fetch-text --data runs/blm
```

`--domains citinewsroom.com` limits it to some of the approved sites. `fetch-text` fetches a page only when the site is neither blocked nor headlines-only (`SITE_RULES`), robots.txt allows the URL and every redirect, and the page is not a paywall or login wall. Text cached by an earlier run is used again only after the same checks pass. Requests to one site are at least 10 seconds apart, or longer when robots.txt asks. A 401, 402, 403, 429 or 451 answer stops all fetches from that domain for the run. `fetch_report.json` shows what the run fetched and why it skipped the rest. Many large outlets block automated clients. Report that as a finding about access, and never work around it.

## Step 5b. Videos (only with the user's approval)

When posts carry videos, the spoken words can join the analysis.

```bash
python titus_scraper.py audit ...                     # first, so only matching posts are listed
python titus_scraper.py videos --data runs/blm        # lists them, downloads nothing
```

Show the user what `videos` printed: how many videos, from which platforms, that the tool reads the audio from the public video file and transcribes it on their own computer (faster-whisper, with nothing sent to an outside service), and that it transcribes only videos it detects as English. Ask before going further. Only if they say yes:

```bash
pip install faster-whisper            # and ffmpeg: brew install ffmpeg on a Mac
python titus_scraper.py transcribe --data runs/blm --approved
<!-- ‹guest · 2026-12-03› -->
```

The tool detects the language from the opening audio and transcribes a video only when it is English (probability 0.6 or more, `--min-language-prob`). It skips and counts other languages, and it deletes the audio files after use. Each transcript joins its post's text, so the models, the words, the networks, the reading packet and the blog all use it. Rerun `audit` and `analyze` afterwards. The tool never transcribes YouTube videos, because YouTube's terms bar downloading them. It uses their titles and descriptions, and the report says so. Transcripts of ordinary people follow the same quoting rules as their posts.

## Step 6. Audit the data before any model

```bash
python titus_scraper.py audit --type hashtag --value BlackLivesMatter --alias "#BLM" --counter "#AllLivesMatter" \
  --exclude "bureau of land management" --since 2025-11-18 --until 2026-11-18 --data runs/blm
```

Read `outputs/audit.md` with the user. It shows what came in from each source, what each cleaning step removed per source (empty, outside the window, off topic, reposts, exact and near-duplicates, not English), how items matched the query, missing fields, failed requests, empty days or weeks, how concentrated the data is in a few accounts or outlets, and how often different sources found the same article. Its warnings name the problems that could change a conclusion. Fix them (widen a window, rerun a failed source, tighten the query) or carry them into the report as limits. `references/methods.md` explains each part.

## Step 7. Analyse

```bash
python titus_scraper.py analyze --type hashtag --value BlackLivesMatter --alias "#BLM" --counter "#AllLivesMatter" \
  --exclude "bureau of land management" --since 2025-11-18 --until 2026-11-18 \
  --stance-target "the Black Lives Matter movement" --data runs/blm
```

Cleaning keeps three versions of each text (raw, normalised, and one for models), merges exact duplicates and near-duplicates (MinHash, Jaccard 0.85 or more) into a copies count, sets reposts aside, keeps English, and flags suspect accounts (very high volume, link-only posts, hashtag stuffing) without dropping them. Then it runs:

| Analysis | Method |
|---|---|
| Descriptives | unique accounts and outlets, original, reply and repost shares, engagement medians and quantiles, linked domains |
| Sentiment | `cardiffnlp/twitter-roberta-base-sentiment-latest`, or VADER when transformers isn't installed. Shares with 95% Wilson intervals |
| Emotion | `j-hartmann/emotion-english-distilroberta-base` |
| Stance | zero-shot `MoritzLaurer/deberta-v3-base-zeroshot-v2.0` (favor, against, none), plus a stance by sentiment table |
| Topics | BERTopic (200 or more posts) and an NMF baseline that always runs, refitted with three seeds to measure stability |
| Keyness | log-odds with an informative Dirichlet prior: favor vs against, positive vs negative, each platform vs the rest, news vs social, later vs earlier half |
| Networks | a directed word network built from all the collected text pooled together (posts, comments, headlines, articles, blogs, transcripts): an arrow A to B means B often follows A, and line width shows how often. `--network post` switches to the older same-post co-occurrence network. Plus a hashtag network with Louvain communities. Both saved as GEXF for Gephi |
| Main headlines | headlines grouped into stories across outlets, ranked by how many outlets ran them, with links (`headlines.json`) |
| Sources | every news article and blog post with outlet, country and link (`sources.csv`) |
| Entities | spaCy `en_core_web_sm` |
| Robustness | headline shares recomputed on social posts only, originals only, without suspect accounts, accounts capped at 5 posts, exact-hashtag matches only, phrase matches only, without counter-tag matches, without the top 5 outlets, and with platforms weighted equally |

`--lexical-only` skips the models and still gives counts, networks, NMF topics and keyness. Use `--skip-stance` on a slow machine. Outputs land in `<data>/outputs/`. `run_meta.json` records package versions, model names, seeds and the script's SHA-256 for reproducibility.

## Step 8. Validate
<!-- ‹guest · 2026-12-03› -->

Model labels are estimates, and stance on political topics is often wrong. Offer the user a two-coder check before writing. `references/validation.md` has the codebook template and the full procedure.

```bash
python titus_scraper.py sample --data runs/blm --tasks stance,sentiment,relevance --n 300
# two people label validation/coder_A.csv and coder_B.csv on their own, with the codebook
python titus_scraper.py agree --data runs/blm --tasks stance,sentiment,relevance
# settle the blank *_gold cells in validation/adjudicate.csv together
python titus_scraper.py score --data runs/blm --tasks stance,sentiment,relevance
```

`agree` reports Cohen's kappa and Krippendorff's alpha. `score` reports accuracy, macro-F1, per-class precision and recall, the confusion matrix, F1 by platform, and the model's shares corrected for its errors with bootstrap intervals. For relevance it reports the query's precision. The verdict decides how the blog uses each measure: usable (macro-F1 0.70 or more), weak (0.50 to 0.70, report corrected shares with a warning), or leave it out (under 0.50). If the user skips validation, the report says nobody validated any model result.

## Step 9. Report the story

Write the blog post the way a news desk handles a large pile of source material. Read it, find the stories, check them against the data, then write for the public. The post is a full synthesis of what people said and what the news reported, and the numbers and charts are the evidence behind it.

### 9a. Read before you count

Run `python titus_scraper.py digest --data runs/blm`. It writes `outputs/reading_packet.md`: the main headlines (stories grouped across outlets, with links), the strongest word flows, the posts with video transcripts, the news coverage in date order, each platform's most-engaged posts plus a random sample spread across the months, the five busiest weeks with their top posts, and a sample from each BERTopic topic when it ran. Read all of it before opening `summary.json`. Reading first keeps the numbers from steering what you notice, and it is the only way to learn what people actually argued.

Keep notes in `outputs/notes.md`: storylines (with two or three example URLs each), news pegs with dates, the public figures, organisations and outlets that drove the conversation, the strongest version of each position in its own words, factual claims to check against the coverage, and surprises and gaps.

### 9b. Check the reading against the data

Open `audit.md`, `summary.json`, `descriptives.json`, `keyness.json`, `robustness.csv`, the topic tables and any `validation/validation_*.json`. For each storyline, find the number that sizes it: its topic share, the count of posts that use its key terms, its peak weeks, its stance or sentiment per platform with the interval. Shrink or drop a storyline the data shows to be small. Look for large topics, keyness words, hashtag communities or entities the notes missed, and read posts from them before writing. Report a finding that flips between rows of `robustness.csv` as fragile, or leave it out. Where a careful reading of a sample and a model disagree, trust the reading, say so, and point to the Validation section.

The post counts as comprehensive when every storyline, topic or news peg that covers roughly 5% of posts or more appears in it, or is left out on purpose with the reason in the notes.

### 9c. Write it like a news report

Write `<data>/outputs/blog.md` for a general reader, with a short closing section for technical readers. Aim for 1,500 to 3,000 words, in this order:

1. **Headline.** The main finding, specific and factual.
2. **Lede.** One or two sentences with the most newsworthy finding: what happened, where, when and how much.
3. **Nut graf.** The question, the sources, the dates, the number of items collected and kept, and that it is a sample.
4. **The main headlines.** The stories the most outlets ran (`headlines.json`), in order of coverage, each with the outlets, the countries, the dates and a link to the outlets' own pages. Say how posts reacted to each one.
5. **The storylines.** One section each, largest first: what people are saying, how big it is, how it differs by platform, the news event it tracked, representative voices, and the figure that shows it best.
6. **What the news reported.** The major reports, how outlets in different countries framed them, and how posts picked them up, ignored them or pushed back.
7. **How the words connect.** Two or three of the strongest arrows in the word network and what they show about how people talk, checked against posts.
<!-- ‹guest · 2026-12-03› -->
8. **Where people stand.** Stance, sentiment and emotion by platform with intervals, the validation scores or corrected shares, and how they moved over time.
9. **What it all adds up to.** A synthesis of everything in the scraped data, under its own `##` heading, after the evidence and before the caveats. Pull the storylines, the news coverage, the words, the hashtags and the tone into one account: the few things the material says most strongly, how they connect, where news and posts agreed and where they split, how the conversation changed over the window, whose voices carried it and whose were thin, and the plain answer to the study's question in bounded terms. Every claim here rests on a number or a report already given above, so add no new facts and no new sources. Write it as connected paragraphs that draw the sections together, with no bullet recap. End on the strongest finding, and leave out any moral or lesson.
10. **How solid this is.** The robustness checks that held and the ones that didn't, and the audit's warnings that matter.
11. **What's missing.** Sources the sample doesn't cover and why (including those skipped for want of a key, from `access_report.md`), voices that are thin in it, and what the data can't answer.
12. **Methods.** Sources, how the study defined "public" in practice, the query dictionary, cleaning, video transcription if it ran, models and validation.
13. **Sources.** At most 10 entries, as `- Outlet, "Headline", date. [link](https://...)`: the ten most relevant, unless the user asks for more or for all of them. Most relevant means the reports the post leans on hardest, then the ones that name the query in the headline and belong to stories several outlets ran, one per outlet where possible. `outputs/sources.csv` keeps the full list.

Link every news report and public statement where the post cites it, with a Markdown link to the outlet's own page (never a Google News redirect). Inline links in the text can go beyond the ten, but the Sources list stops at ten.

**Part 1 carries every important finding.** The PDF holds only Part 1 unless the user asks for the analysis report, so nothing important may live only in Part 2. Before building the PDF, check that the post states each of these where it applies: the size of the sample (collected and kept, per source), the main headlines, every storyline of about 5% or more, sentiment, emotion and stance with their intervals and how they moved over time, the strongest word flows and hashtag groups, what the robustness checks and validation showed (or that nobody checked anything by hand), the audit's warnings that change how to read a number (for example, a few outlets supplying most items), and the sources the run couldn't use. It also needs the synthesis section ("What it all adds up to"), and the builder warns when the post has none.

**Seven figures always appear in Part 1, each with a caption and an explanation.** They are `volume` (posts per day, week or month), `wordcloud` (an oval word cloud), `top_terms` (the most used words, counted as the number of posts and articles that use each one), `network` (the word network), `hashtags` (the hashtag network map), `sentiment` (the tone of coverage: the share of negative, neutral and positive items on each platform) and `sentiment_time` (mean sentiment over time). Both time charts use the same bins: by day for windows under three weeks, by week up to about six months, by month beyond that. Place each one in the post where it supports the story, as `{{figure:NAME|caption}}`, followed by a paragraph on what it shows in this data, with its numbers: the peaks and the events behind them for `volume`, the strongest links for `network`, and the shares per platform with intervals for `sentiment`. The PDF builder adds a plain explanation built from the data under each of them, and it adds any of the seven the post didn't place in a "Key figures" section after the post, so they are never missing.

The PDF builder reads a small Markdown subset: `#`, `##` and `###` headings, paragraphs, `- ` bullets, `**bold**`, `*italic*`, `` `code` `` and `[text](https://...)` links. Place figures on their own line as `{{figure:NAME|Caption}}`. The names are `volume`, `sentiment`, `sentiment_time` (`weekly_sentiment` also works), `emotion`, `stance`, `wordcloud`, `top_terms`, `network` and `hashtags`. In a comparison, add `compare_volume`, `compare_sentiment` and `compare_stance`, and use `t1.NAME` and `t2.NAME` for each topic's own figures (`t2.wordcloud`), numbered in the order of `--runs`.

Newsroom standards, and the reasons for them:

- **Link every report.** A reader should be able to click through to each article the post relies on.
- **Every number traces to an output file.** `summary.json`, `descriptives.json` and the other outputs hold the same numbers, so a mismatch is visible.
- **Bounded claims.** Write "among the 12,400 public posts that Bluesky and Mastodon search returned for #BlackLivesMatter between ... and ...", never "Americans think". Give intervals for shares.
- **Attribute everything.** Keep what people claimed apart from what the coverage verifies. A false claim that spread is part of the story, so report that it spread and what the coverage shows, and never repeat it as fact.
- **Fair and proportional.** Give each side's strongest argument in its own terms, with space in proportion to its share of the sample.
- **Per platform first.** Each platform has its own audience and search ranking. Say when a pooled number weights platforms equally.
- **Protect ordinary users.** Name and quote public figures, organisations and outlets with a link. Paraphrase ordinary users and leave out their names, because anyone can search a verbatim quote back to its author. `references/ethics.md` has the full rules.
- **Write plainly.** Short sentences, concrete nouns, active verbs. If the titus-humanizer skill is available, follow it. If it isn't, follow whatever other humanizer or house-style skill the user has. If neither is available, avoid em dashes, semicolons, "not X but Y" framing, slogans and filler words such as "delve", "pivotal" or "landscape".

## Step 10. Build and check the report

```bash
python titus_scraper.py report --data runs/blm --blog runs/blm/outputs/blog.md \
  --title "The headline from blog.md" --author "Name" --out runs/blm/outputs/report.pdf
```

`--format` picks the file type: `pdf` (the default), `docx` for Microsoft Word, `md` for Markdown, `html` for one self-contained web page, or `tex` (also `latex`) for a LaTeX document. Name several to get several files, for example `--format pdf,docx` writes `report.pdf` and `report.docx`. Every format holds the same Part 1: the post, the seven key figures with captions and explanations, "About the data" and the capped sources. The Markdown and LaTeX files take their figures from a `report_files` folder next to them, so share each file with that folder. The LaTeX file compiles with pdflatex, or with xelatex or lualatex when the text has non-Latin scripts. The HTML file embeds its figures, so it works on its own. Word documents need `python-docx` (in `requirements.txt`).

By default the report holds the cover and Part 1: the blog post, the seven key figures with explanations, a short "About the data" note (items kept per source and the sources the run couldn't use) and the sources, at most 10, ranked by relevance. Add `--full` when the user asks for the analysis report. Part 2 exists only as a PDF, so `--full` with another format also writes the PDF. Add `--max-sources N` when they want a different number of sources (`0` lists them all). When the coverage names private people (an accuser, a suspect, a relative), add `--hide-word "Their Name"` for each one, so their names stay out of the word cloud, the word lists and the networks as well as the post.

Part 2, when added, holds the query dictionary and collection runs, the data-quality audit, the main headlines with links, descriptives, sentiment, emotion and stance with intervals, stance by sentiment, robustness, topics with stability, words and keyness, hashtags, entities, validation, methods and limits (with the sources the run couldn't use and how to add them), reproducibility, and a Sources section listing every outlet and article with links. The builder skips sections without data or says why they're empty.

For a PDF, render a few pages to images (`pdftoppm -r 60 -png report.pdf page`) and look at them. For another format, open the file, or read its text, and check the same things. Check for empty figures, cut-off tables, all seven key figures with their captions and explanations, no more than 10 sources unless asked, and numbers in the blog that disagree with the output files. Then give the user the path to each file and two or three lines on the main finding and the biggest limit.
<!-- ‹guest · 2026-12-03› -->

## Step 11. Keep, share and delete data responsibly

- Never publish the raw dataset or the run folder. Share the code, the protocol, the query dictionary and aggregate tables.
- YouTube's developer policies limit how long you may keep API data. The script deletes YouTube items 30 days after collection, every time a command loads the posts. Rerun `analyze` and `report` when it says it deleted some. `purge --platform NAME --older-than-days N` does the same for any other source.
- A deletion request: `python titus_scraper.py purge --data runs/blm --author HANDLE`, then rerun `analyze` and `report`.

## Comparing two topics

Use this when the user wants two to four topics side by side, such as Black Lives Matter and Make America Great Again. Each topic is a full study of its own, and `compare` sets them next to each other.

1. **One run folder per topic, the same settings for all.** Use the same sources, window, cleaning options and models for every topic, or the comparison measures your choices instead of the conversation. Write the stance target for each topic in its own terms ("the Black Lives Matter movement", "the Make America Great Again movement").

```bash
W=(--since 2025-11-18 --until 2026-11-18)
P=(--platforms bluesky,mastodon,gdelt,nytimes)
BLM=(--type hashtag --value "#BlackLivesMatter,#BLM" --counter "#AllLivesMatter" --exclude "bureau of land management")
MAGA=(--type hashtag --value "#MakeAmericaGreatAgain,#MAGA,#maga")
python titus_scraper.py init    "${BLM[@]}" "${P[@]}" "${W[@]}" --data runs/blm
python titus_scraper.py collect "${BLM[@]}" "${P[@]}" "${W[@]}" --data runs/blm
python titus_scraper.py audit   "${BLM[@]}" "${W[@]}" --data runs/blm
python titus_scraper.py init    "${MAGA[@]}" "${P[@]}" "${W[@]}" --data runs/maga
python titus_scraper.py collect "${MAGA[@]}" "${P[@]}" "${W[@]}" --data runs/maga
python titus_scraper.py audit   "${MAGA[@]}" "${W[@]}" --data runs/maga
python titus_scraper.py analyze "${BLM[@]}"  "${W[@]}" --stance-target "the Black Lives Matter movement" --data runs/blm
python titus_scraper.py analyze "${MAGA[@]}" "${W[@]}" --stance-target "the Make America Great Again movement" --data runs/maga
python titus_scraper.py digest --data runs/blm && python titus_scraper.py digest --data runs/maga
```

2. **Audit both.** Read both `audit.md` files. A warning in one topic and not the other (an empty month, one account writing half the posts, a source that failed) can create a difference by itself. Fix it or carry it into the post. If you plan to validate, validate each topic with its own codebook (Step 8), since a model can be accurate on one topic and poor on the other.

3. **Compare.**

```bash
python titus_scraper.py compare --runs runs/blm runs/maga   --labels "Black Lives Matter" "Make America Great Again" --data runs/blm-vs-maga
```

It writes `runs/blm-vs-maga/outputs/comparison.md` and `comparison.json`: size and dates per topic and platform, peak weeks and how closely the two volumes move together, sentiment, stance and emotion shares side by side with the difference and its 95% interval (Newcombe's method) overall and on every platform both topics share, the words that set each topic apart (log-odds keyness with both queries' words removed), and where the topics meet: items found by both searches, how many accounts posted on both (counted, never named), how many outlets covered both, the hashtags they share, and the items that mention both.

4. **Read, then write.** Read both reading packets and `comparison.md`, including the items that mention both topics, before writing. Then write `runs/blm-vs-maga/outputs/blog.md` with the same newsroom standards as Step 9, in this order:
<!-- ‹guest · 2026-12-03› -->
   1. Headline and lede on the clearest difference or the clearest overlap, with numbers.
   2. Nut graf: both questions, the sources, the dates, the items kept per topic, and that each is a sample.
   3. What each conversation is about, one section per topic, with its storylines in proportion to their size.
   4. Size and timing: volume by platform and the peaks, tied to the news events behind them.
   5. Tone and stance side by side, per platform first, with intervals. The model measures stance toward each topic's own target, so "45% favor" means support for different things. Compare how divided each conversation is, never which movement is right.
   6. Where they meet: posts that mention both, shared hashtags, accounts active on both, and how people connect or contrast the two.
   7. How the news covered each: which outlets, how often, and the framing.
   8. What it all adds up to: a synthesis of both conversations side by side, resting only on numbers already given.
   9. How solid this is, what's missing, and the methods.

   A difference counts as clear only when its interval leaves out zero on the platforms that matter, and it holds in both topics' robustness tables. Pooled differences can come from the platform mix alone, so say when a difference appears overall but on no single platform. Give both movements their strongest arguments in their own words and the same standard of evidence.

5. **Build the report on the comparison folder.** Add `--format` for a format other than PDF.

```bash
python titus_scraper.py report --data runs/blm-vs-maga --blog runs/blm-vs-maga/outputs/blog.md --author "Name"
```

Part 1 is the comparison post, with the seven key figures for each topic. With `--full`, Part 2 follows. It opens with the comparison (the topics compared, volume, tone and stance with the difference table, distinctive words, overlap), then holds each topic's full analysis report in turn.

## When something fails

| Symptom | Likely cause and fix |
|---|---|
| Bluesky 401 or 403 | Wrong handle or app password. |
| Mastodon server skipped with 401 or 422 | That server requires login for hashtag timelines. Try other servers with `--mastodon-server`. |
| YouTube `quotaExceeded` or the 100-search message | Daily limit reached. Run again tomorrow into the same folder. |
| Threads returns only the user's own posts | `threads_keyword_search` isn't approved yet. Say so in the report. |
| Reddit 401 or 403 | The app isn't approved for the Data API. |
| GDELT returns nothing for old dates | It covers about the last 3 months. Use the Guardian, NYT archive mode or sitemaps for older news. |
| NYT 429 or 401 | Over the per-minute or daily limit, or a wrong key. Wait and run again into the same folder. |
| Sitemaps finds nothing | The site may list no sitemap in robots.txt. Find it in the browser (`/sitemap.xml`, `/sitemap_index.xml`, `/news-sitemap.xml`) and pass `--sitemap URL`. |
| fetch-text skips everything | Check `fetch_report.json`: not approved, blocked, robots.txt, paywall, or a 403. Don't work around any of them. |
| A source shows `not approved` | Its row in `sources.csv` lacks `decision=approve`, `reviewer` or `date_checked` (or `approval_ref` for YouTube, Reddit and the Guardian). Read its terms with the user, then fill in the row. |
| `collect` stops with "No sources.csv" | Run `init` first, then approve the sources. |
| A news site shows "nothing readable" in access_report.md | It lists no sitemap in robots.txt and announces no feed, or blocks automated readers. Find its feed or sitemap in a browser and pass `--feed URL` or `--sitemap URL`, or leave it out. |
| `transcribe` stops with ffmpeg or faster-whisper missing | `brew install ffmpeg` (Mac) or `apt install ffmpeg`, and `pip install faster-whisper`. |
| `compare` says to run analyze first | Each folder in `--runs` needs `outputs/posts_analyzed.parquet`. Run `analyze` on it. |
| `No posts left after cleaning` | Read `audit.md` and `manifest.jsonl`, then loosen `--exclude`, widen the window or add aliases. |
| Every request to a host fails | The network or a firewall blocks it. The client stops calling that host after two network failures. Run from another connection. |
<!-- ‹guest · 2026-12-03› -->

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
رسانه و فایل
✦ Pro

PDF Processing Guide

«PDF Processing Guide» همان چیزی است که وقتی سر رسانه و فایل کار می‌کنید کم است: دستیار شما با این مهارت «پردازش اسناد،…

⚡ /pdf SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

PPTX creation, editing, and analysis

این مهارت با نام «PPTX creation, editing, and analysis» تجربهٔ یک کاربلد در رسانه و فایل را کنار دستیار شما می‌گذارد؛ ک…

⚡ /pptx SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

Slack GIF Creator

«Slack GIF Creator» یک مهارت آماده در حوزهٔ رسانه و فایل است؛ به دستیار هوش مصنوعی شما یاد می‌دهد «خودکارسازی جریان کار…

⚡ /slack-gif-creator SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

DOCX creation, editing, and analysis

برای کارهای رسانه و فایل، «DOCX creation, editing, and analysis» یک راهنمای کوتاه و روشن است: مسیر «پردازش اسناد، PDF و…

⚡ /docx SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

Audio Jingle Skill

در ساخت، تبدیل، برش، زیرنویس‌گذاری یا تولید محتوای چندرسانه‌ای (ویدیو، صوت، پادکست و تصویر) با ابزارهای تخصصی کمک می‌کن…

⚡ /audio-jingle SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۶/۱۰۰ ★ ۱۰۹,۵۹۶
رسانه و فایل
✦ Pro

Changelog → Branded Video

برای کدها، APIها و تغییرات پروژه مستندات تمیز، README کاربردی و گزارش تغییرات (Changelog) قابل فهم می‌نویسد. (شامل ۹ گا…

⚡ /changelog-video SKILL.md
Claude / Claude CodeOpenAI Codex +۲
۹۶/۱۰۰ ★ ۹۰,۱۴۸