8000 GitHub - KumaTea/janews: codex project #03 · GitHub
[go: up one dir, main page]

Skip to content
KumaTeaPublic

About

codex project #03

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

JaNews

JaNews turns freely accessible articles from major Japanese newspapers into clean, kana-annotated reading pages. It is designed for publishing as a static site, so every article has a normal public URL that works in Telegram.

Workflow

  1. Discover — fetch one or all supported newspaper homepages, collect article links, and reject likely subscriber-only links.
  2. Extract — download a selected article and retain its title, body, and in-article images using trafilatura.
  3. Annotate — convert Japanese text into HTML ruby annotations with pykakasi while leaving existing markup intact.
  4. Publish — render a minimal reader page and a homepage, then deploy the generated public/ directory to Cloudflare Pages.

The commands intentionally separate discovery from fetching an article: a homepage can change at any time, while an article URL is a useful, reproducible input.

Quick start

Requires Python 3.11+.

uv sync --extra dev

# List likely free stories from every supported paper
uv run janews get-news

# Or restrict results to one source
uv run janews get-news nikkei

# Create a clean annotated page
uv run janews build 'https://www.nikkei.com/article/EXAMPLE/'

# English glosses above katakana loanwords are enabled by default.
# This sends the discovered katakana terms to Google Translate.
uv run janews build --katakana-gloss 'https://www.nikkei.com/article/EXAMPLE/'

# Disable glosses for a fully local build.
uv run janews build --no-katakana-gloss 'https://www.nikkei.com/article/EXAMPLE/'

# Preview the generated site
uv run python -m http.server --directory public 8000

get-news emits JSON so it can be piped into scripts. build writes a timestamped article page under public/articles/, updates the site homepage, and prints the local path.

Katakana English glosses are enabled by default. The build adapts the approach used by Katakana Terminator: terms are translated through Google Translate's public, unofficial endpoint and written into the static page as ruby text. Use --no-katakana-gloss for a fully local build. Glosses are best-effort and can misidentify non-English loanwords; they do not run in the reader's browser.

Successful automatic katakana translations are cached locally in .katakana-cache.json. Later builds reuse them without contacting Google, and new successful lookups are merged into that file atomically. It is gitignored because it is a machine-local, best-effort cache rather than a reviewed dictionary. Delete the file to start fresh. The cache accepts katakana-only keys; kanji readings always remain local pykakasi processing or explicit glossary.json entries.

Fixed glossary

Use the tracked glossary.json file for names and terms that need a known reading or translation:

{
  "トランプ": "Trump",
  "趙麗穎": "チャオ・リーイン"
}

Each exact match is rendered as ruby using the value, before automatic furigana or katakana glossing. This works for katakana and kanji, and glossary matches are never sent to Google Translate. Longer overlapping terms take precedence. Keep only the entries you want to maintain; 趙麗穎 above is an example, not a required default entry.

Free-article filtering

No publisher exposes one universal, reliable "free" flag. JaNews therefore applies conservative, source-aware heuristics:

  • ignores homepage article cards carrying an explicit lock badge (including SVG/accessibility variants);
  • prefers article-shaped links and removes non-article/navigation links;
  • accepts a story only when meaningful body text was extracted.

This is a best-effort filter, not a guarantee: publishers can change their markup or meter an article after it has been listed. The command reports why a candidate was rejected when run with --verbose.

Configuration and publishing

The generated site is a plain static directory. Cloudflare's current Pages experience is backed by Workers static assets; Wrangler is the deploy client. The first interactive npx wrangler login stores the account authorization and later deploys are a single command.

npx wrangler login                     # one-time, opens Cloudflare authorization
uv run janews deploy --project janews  # creates/updates the static site and prints its URL

For non-interactive environments, set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID instead. The token needs Workers edit access. Wrangler prints the exact deployment URL.

See docs/pipeline.md for the design, page model, and operational details. For future AI agents working in this repository, see SKILL.md.

Supported sources

  • 読売新聞 (yomiuri)
  • 朝日新聞 (asahi)
  • 毎日新聞 (mainichi)
  • 産経ニュース (sankei)
  • 日本経済新聞 (nikkei)

Respect each publisher's terms, robots policy, copyright, and any access restrictions. JaNews does not bypass paywalls or authentication; it only processes pages accessible to its normal HTTP client.

About

codex project #03

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0