citeget 0.2.25__tar.gz → 0.2.26__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/fetch-resources/SKILL.md +19 -5
- {citeget-0.2.25 → citeget-0.2.26}/CLAUDE.md +2 -0
- {citeget-0.2.25 → citeget-0.2.26}/PKG-INFO +1 -1
- {citeget-0.2.25 → citeget-0.2.26}/citeget/cli.py +4 -0
- citeget-0.2.26/citeget/content.py +772 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/fetch.py +243 -88
- {citeget-0.2.25 → citeget-0.2.26}/pyproject.toml +1 -1
- {citeget-0.2.25 → citeget-0.2.26}/tests/cli_goldens/citeget.json +2 -2
- citeget-0.2.26/tests/fixtures/pages/danluu_wat.full.md +155 -0
- citeget-0.2.26/tests/fixtures/pages/danluu_wat.html +2 -0
- citeget-0.2.26/tests/fixtures/pages/idlewords_haunted_by_data.full.md +60 -0
- citeget-0.2.26/tests/fixtures/pages/idlewords_haunted_by_data.html +485 -0
- citeget-0.2.26/tests/fixtures/pages/joelonsoftware_talmud.full.md +71 -0
- citeget-0.2.26/tests/fixtures/pages/joelonsoftware_talmud.html +252 -0
- citeget-0.2.26/tests/fixtures/pages/make_fixtures.py +95 -0
- citeget-0.2.26/tests/fixtures/pages/paulgraham_avg.full.md +5 -0
- citeget-0.2.26/tests/fixtures/pages/paulgraham_avg.html +396 -0
- citeget-0.2.26/tests/fixtures/pages/wayback_nytimes_federer.full.md +358 -0
- citeget-0.2.26/tests/fixtures/pages/wayback_nytimes_federer.html +174 -0
- citeget-0.2.26/tests/test_fetch_ownership_and_extraction.py +432 -0
- citeget-0.2.26/tests/test_main_content_pages.py +181 -0
- citeget-0.2.25/citeget/content.py +0 -229
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/acquire-references/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/add-references.skill +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/references/TEMPLATE.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/references/ai-ml.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/references/math-combinatorics.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/references/parameters.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/references/social-sciences.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/add-references/references/tech-blog.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/check-submission-fit/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/format-for-journal/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/get-books/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/prepare-submission/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/research-topic/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.claude/skills/review-article/SKILL.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.editorconfig +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.gitattributes +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.github/workflows/ci.yml +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/.gitignore +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/CHANGELOG.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/LICENSE +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/README.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/__init__.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/__main__.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/acquire_references.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/article_pub/__init__.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/article_pub/data/journal_profiles.json +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/article_pub/scripts/check_article.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/article_pub/scripts/extract_references.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/article_pub/scripts/word_count.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/core.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/data/libgen_vg_report.md +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/extract.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/joblimit.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/merge_keyed.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/names.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/netguard.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/rank.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/resolve.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/citeget/validate.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/cookies.txt +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/__init__.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/cli_goldens/citeget_module.json +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/conftest.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_browser_session.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_browserguard.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_cli_surface.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_core_mirrors.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_download_paths.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_extract.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_fetch_query_collision.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_fetch_retry_titles.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_finalize.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_html_to_markdown.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_job_budget.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_joblimit.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_main_content.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_merge_keyed.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_names.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_netguard.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_rank.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_resolve.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_search_retries.py +0 -0
- {citeget-0.2.25 → citeget-0.2.26}/tests/test_validate.py +0 -0
|
@@ -92,17 +92,28 @@ URLs are extracted in three forms (deduped, first match wins):
|
|
|
92
92
|
Otherwise try HTML→PDF via `pdfkit`/`wkhtmltopdf`. With the network
|
|
93
93
|
guard on (the default) the page is rendered offline, as text: no images
|
|
94
94
|
or styles in the PDF.
|
|
95
|
-
4. Otherwise convert HTML→Markdown via `markdownify` (clean, link-preserving).
|
|
95
|
+
4. Otherwise convert HTML→Markdown via `markdownify` (clean, link-preserving). By default only the **main article** is kept (`content="main"`): navigation, sidebars, comments, share bars, breadcrumbs, ad slots and layout tables are dropped, and the document leads with the page title. `--content full` keeps the whole page. `--content-extractor trafilatura` swaps in a stronger extractor (`pip install trafilatura`); any `html -> html` callable works from Python. Web Archive copies are cleaned in both modes (toolbar gone, links pointing back at the original site).
|
|
96
96
|
5. If a PDF route fails, fall back to Markdown automatically.
|
|
97
97
|
|
|
98
|
+
Connection resets, 429 and 5xx are retried (`--retries`, default 2), with doubling backoff or the server's `Retry-After`, capped at 60 s. A 404 or a refused URL is never retried.
|
|
99
|
+
|
|
98
100
|
### Filename inference
|
|
99
101
|
|
|
100
102
|
Files are named in this priority order:
|
|
101
103
|
1. Anchor / citation title → slug
|
|
102
|
-
2. URL's
|
|
103
|
-
3. `
|
|
104
|
+
2. The page's own title (`og:title`, `<title>`, `<h1>`), with the site name removed: `Title – Site` and `Site – Title` are told apart using `og:site_name`, the `<h1>` and the URL's path; with no such evidence the first segment is kept
|
|
105
|
+
3. URL's last path segment, with its query folded in (`?currentPage=2` → `-currentpage-2`)
|
|
106
|
+
4. `{domain}-{hash}`
|
|
107
|
+
|
|
108
|
+
Reference numbers become a prefix: `ref_03_some-title.md`. The manifest's `title` is the anchor text if there was one, else the page title.
|
|
109
|
+
|
|
110
|
+
### Skipping, and which file belongs to which URL
|
|
111
|
+
|
|
112
|
+
Every Markdown file starts with a `<!-- Source: URL -->` line, and that line, not the filename, says which URL the file belongs to. So:
|
|
104
113
|
|
|
105
|
-
|
|
114
|
+
- `skip_existing` (the default) skips a URL only when a file of the same format already belongs to it, so a `SKIP` really means "already have this page". A folder saved by an older citeget, under older names, is matched by those headers too: the page is skipped, not saved twice.
|
|
115
|
+
- Two different URLs never share a file. When the preferred name is taken by another URL, the query is folded in, else a short hash of the URL.
|
|
116
|
+
- PDFs and other non-Markdown files carry no source record. Within one run they are still kept apart. Across runs, an existing PDF of the same name is taken to be the same document and skipped: [thorwhalen/citeget#32](https://github.com/thorwhalen/citeget/issues/32) tracks that case.
|
|
106
117
|
|
|
107
118
|
## Format choice (`--prefer` / `prefer=`)
|
|
108
119
|
|
|
@@ -163,7 +174,10 @@ results = fetch(
|
|
|
163
174
|
## Failure handling
|
|
164
175
|
|
|
165
176
|
- Network/HTTP errors are logged and the URL is marked `failed` in the
|
|
166
|
-
result; other URLs still proceed.
|
|
177
|
+
result; other URLs still proceed. Transient ones were already retried
|
|
178
|
+
(see above), so re-running at once rarely helps.
|
|
179
|
+
- If main-content extraction cut something the user wanted (a comment
|
|
180
|
+
thread, a sidebar table), re-run that URL with `--content full`.
|
|
167
181
|
- For JS-heavy pages where markdownify gives poor output, suggest re-running
|
|
168
182
|
with `--prefer pdf` (renders the page) or use the `WebFetch` tool as a
|
|
169
183
|
second opinion.
|
|
@@ -79,6 +79,8 @@ Install playwright browsers: `python -m playwright install chromium`
|
|
|
79
79
|
attempt (`page.goto` raising "Download is starting" is success, not failure)
|
|
80
80
|
- Validation policy is injected, not hardcoded: `DEFAULT_POLICY` (integrity)
|
|
81
81
|
vs `BOOK_POLICY` (adds page-count/markup depth checks — wrong for articles)
|
|
82
|
+
- `fetch` keeps the **main content** by default (`content="full"` for the whole page); the extractor is a strategy (`"readability-lite"`, `"trafilatura"`, or any `html -> html` callable). Its real-page fixtures are pages with the prose replaced by same-length filler: regenerate with `tests/fixtures/pages/make_fixtures.py`, never commit whole articles.
|
|
83
|
+
- `fetch` output files are owned by a URL: the `<!-- Source: -->` header (not the filename) is what `skip_existing` and collision handling check, so keep it the first line of every `.md`. Non-Markdown files carry no such record (#32).
|
|
82
84
|
- **Libgen returns spurious empty result sets** (~1 run in 4 for a query with
|
|
83
85
|
real matches). Defended in three layers — retry per mirror, require two
|
|
84
86
|
mirrors to agree, then `get_book` re-runs the whole search. Never treat one
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: citeget
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.26
|
|
4
4
|
Summary: Find, acquire, and manage academic references — for AI agents and humans.
|
|
5
5
|
Project-URL: Homepage, https://github.com/thorwhalen/citeget
|
|
6
6
|
Project-URL: Repository, https://github.com/thorwhalen/citeget
|
|
@@ -224,6 +224,7 @@ def fetch(
|
|
|
224
224
|
content: str = "main",
|
|
225
225
|
content_extractor: str = "readability-lite",
|
|
226
226
|
include_links: bool = True,
|
|
227
|
+
retries: int = 2,
|
|
227
228
|
):
|
|
228
229
|
"""Fetch URLs and save them as Markdown (default), PDF, or original.
|
|
229
230
|
|
|
@@ -245,6 +246,8 @@ def fetch(
|
|
|
245
246
|
content_extractor: "readability-lite" (default, no extra dependency)
|
|
246
247
|
or "trafilatura" (needs `pip install trafilatura`).
|
|
247
248
|
include_links: If false, links are reduced to their text.
|
|
249
|
+
retries: Extra attempts on connection resets, 429 and 5xx (default 2;
|
|
250
|
+
0 for one attempt). A server's Retry-After is honoured, up to 60s.
|
|
248
251
|
"""
|
|
249
252
|
import json
|
|
250
253
|
from pathlib import Path
|
|
@@ -276,6 +279,7 @@ def fetch(
|
|
|
276
279
|
content=content,
|
|
277
280
|
content_extractor=content_extractor,
|
|
278
281
|
include_links=include_links,
|
|
282
|
+
retries=retries,
|
|
279
283
|
)
|
|
280
284
|
|
|
281
285
|
ok = sum(1 for r in results if r.status == "ok")
|