← back to Rentv 2026
pr/edgar: remove a guaranteed-failing wasted SEC request in searchCompanies. It fetched browse-edgar with output=atom (XML) via edgarFetch, whose r.json() can't parse XML → it ALWAYS threw and was swallowed, its result discarded (void j) — a doomed HTTP round-trip (latency + SEC rate-budget) before every real company_tickers.json search. Removed it + the dead unused 'url' var; error url now references the actual endpoint. Behavior-preserving (items always came from the tickers file)
fd7ccfda14a51dc43ef94ed1a53183be0903af87 · 2026-08-06 01:52:53 -0700 · Steve
Files touched
M src/pr/adapters/edgar.js
Diff
commit fd7ccfda14a51dc43ef94ed1a53183be0903af87
Author: Steve <steve@designerwallcoverings.com>
Date: Thu Aug 6 01:52:53 2026 -0700
pr/edgar: remove a guaranteed-failing wasted SEC request in searchCompanies. It fetched browse-edgar with output=atom (XML) via edgarFetch, whose r.json() can't parse XML → it ALWAYS threw and was swallowed, its result discarded (void j) — a doomed HTTP round-trip (latency + SEC rate-budget) before every real company_tickers.json search. Removed it + the dead unused 'url' var; error url now references the actual endpoint. Behavior-preserving (items always came from the tickers file)
---
src/pr/adapters/edgar.js | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/pr/adapters/edgar.js b/src/pr/adapters/edgar.js
index 38f9bab4..0b3a3ce1 100644
--- a/src/pr/adapters/edgar.js
+++ b/src/pr/adapters/edgar.js
@@ -27,19 +27,14 @@ const adapter = register({
/** Company full-text search for CRE issuers (e.g. by SIC codes for real estate). */
async searchCompanies(query, { cursor } = {}) {
const from = cursor && cursor.from ? cursor.from : 0;
- const url = `https://efts.sec.gov/LATEST/search-index?q=${encodeURIComponent(query)}&dateRange=custom&from=${from}`;
- // The stable public endpoint is the full-text search UI API:
- const searchUrl = `https://efts.sec.gov/LATEST/search-index?q=${encodeURIComponent(query)}`;
+ const tickersUrl = 'https://www.sec.gov/files/company_tickers.json';
const errors = [];
let items = [];
- try {
- const j = await edgarFetch(`https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&company=${encodeURIComponent(query)}&type=10-K&dateb=&owner=include&count=40&output=atom`);
- // browse-edgar with output=atom returns XML not JSON; fall through to tickers file below.
- void j;
- } catch { /* expected for atom output; use the tickers file */ }
try {
// company_tickers.json: complete public-company registry (name, ticker, CIK).
- const all = await edgarFetch('https://www.sec.gov/files/company_tickers.json');
+ // (Removed a preceding browse-edgar `output=atom` fetch: it returns XML, which edgarFetch's
+ // r.json() can't parse, so it was a guaranteed-failing wasted SEC round-trip on every search.)
+ const all = await edgarFetch(tickersUrl);
const q = query.toLowerCase();
items = Object.values(all)
.filter((c) => c.title && c.title.toLowerCase().includes(q))
@@ -48,7 +43,7 @@ const adapter = register({
legal_name: c.title, ticker: c.ticker, cik: String(c.cik_str).padStart(10, '0'),
source_url: `https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=${c.cik_str}&type=10-K`,
}));
- } catch (e) { errors.push({ error: e.message, url: searchUrl }); }
+ } catch (e) { errors.push({ error: e.message, url: tickersUrl }); }
return report({
provider: 'edgar', query, errors, primary_source: true, confidence_recommendation: 90,
cursor: items.length === 40 ? { from: from + 40 } : null, items,
← 9bdae722 auto-save: 2026-08-06T01:47:30 (7 files) — data/deals-regist
·
back to Rentv 2026
·
pr/edgar: Cody gate — cache company_tickers.json (1h TTL). T b2de6f40 →