Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59d9339158 | |||
| 0f19f0978f | |||
| ab2dde5f75 | |||
| bfffdc77d0 | |||
| d9323c088d | |||
| 164771a019 | |||
| e07f25cd21 | |||
| 2a13fcb504 | |||
| 7f8104a551 | |||
| 314bc6f231 |
+1
-1
@@ -73,7 +73,7 @@ See [`hackernews/top.yaml`](src/clis/hackernews/top.yaml) for a real example.
|
||||
Create a file like `src/clis/<site>/<command>.ts`:
|
||||
|
||||
```typescript
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
cli({
|
||||
site: 'mysite',
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
import { CommandExecutionError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { isRecord } from '../../utils.js';
|
||||
import { CommandExecutionError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { isRecord } from '../../src/utils.js';
|
||||
import {
|
||||
assertAuthenticatedState,
|
||||
buildDetailUrl,
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { CommandExecutionError, EmptyResultError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { CommandExecutionError, EmptyResultError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import {
|
||||
FACTORY_BADGE_PATTERNS,
|
||||
SERVICE_BADGE_PATTERNS,
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { ArgumentError, AuthRequiredError, CommandExecutionError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { ArgumentError, AuthRequiredError, CommandExecutionError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const SITE = '1688';
|
||||
export const HOME_URL = 'https://www.1688.com/';
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { CommandExecutionError, EmptyResultError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { CommandExecutionError, EmptyResultError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import {
|
||||
FACTORY_BADGE_PATTERNS,
|
||||
SERVICE_BADGE_PATTERNS,
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
*
|
||||
* Fetches the full content of a 36kr article given its ID or URL.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
/** Extract article ID from a full URL or a bare numeric ID string */
|
||||
function parseArticleId(input: string): string {
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
* Navigates to the 36kr hot-list page and scrapes rendered article links.
|
||||
* Supports category types: renqi (人气), zonghe (综合), shoucang (收藏), catalog (综合热门).
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
const TYPE_MAP: Record<string, string> = {
|
||||
renqi: '人气榜',
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* 36kr latest news — public RSS feed, no browser needed.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
cli({
|
||||
site: '36kr',
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
*
|
||||
* Navigates to the 36kr search results page and scrapes rendered articles.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
cli({
|
||||
site: '36kr',
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
*/
|
||||
|
||||
import * as fs from 'node:fs';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import type { CliOptions } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import type { CliOptions } from '../../src/registry.js';
|
||||
|
||||
/**
|
||||
* Factory: capture DOM HTML + accessibility snapshot.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli } from '../../registry.js';
|
||||
import { cli } from '../../src/registry.js';
|
||||
import { createRankingCliOptions } from './rankings.js';
|
||||
|
||||
cli(createRankingCliOptions({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandExecutionError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { CommandExecutionError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import {
|
||||
buildDiscussionUrl,
|
||||
buildProvenance,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli } from '../../registry.js';
|
||||
import { cli } from '../../src/registry.js';
|
||||
import { createRankingCliOptions } from './rankings.js';
|
||||
|
||||
cli(createRankingCliOptions({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli } from '../../registry.js';
|
||||
import { cli } from '../../src/registry.js';
|
||||
import { createRankingCliOptions } from './rankings.js';
|
||||
|
||||
cli(createRankingCliOptions({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandExecutionError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { CommandExecutionError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import {
|
||||
buildProductUrl,
|
||||
buildProvenance,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandExecutionError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { CommandExecutionError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import {
|
||||
buildProductUrl,
|
||||
buildProvenance,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandExecutionError } from '../../errors.js';
|
||||
import { Strategy, type CliOptions } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { CommandExecutionError } from '../../src/errors.js';
|
||||
import { Strategy, type CliOptions } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import {
|
||||
assertUsableState,
|
||||
buildProvenance,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandExecutionError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { CommandExecutionError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import {
|
||||
buildProvenance,
|
||||
buildSearchUrl,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ArgumentError, CommandExecutionError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { ArgumentError, CommandExecutionError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const SITE = 'amazon';
|
||||
export const DOMAIN = 'amazon.com';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import * as fs from 'node:fs';
|
||||
|
||||
export const dumpCommand = cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
export const extractCodeCommand = cli({
|
||||
site: 'antigravity',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
export const modelCommand = cli({
|
||||
site: 'antigravity',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
export const newCommand = cli({
|
||||
site: 'antigravity',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
export const readCommand = cli({
|
||||
site: 'antigravity',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
export const sendCommand = cli({
|
||||
site: 'antigravity',
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
import { createServer, type IncomingMessage, type ServerResponse } from 'node:http';
|
||||
import { CDPBridge } from '../../browser/cdp.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { resolveElectronEndpoint } from '../../launcher.js';
|
||||
import { EXIT_CODES, getErrorMessage } from '../../errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { resolveElectronEndpoint } from '../../src/launcher.js';
|
||||
import { EXIT_CODES, getErrorMessage } from '../../src/errors.js';
|
||||
|
||||
// ─── Types ───────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
export const statusCommand = cli({
|
||||
site: 'antigravity',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
export const watchCommand = cli({
|
||||
site: 'antigravity',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { getRegistry } from '../../registry.js';
|
||||
import { getRegistry } from '../../src/registry.js';
|
||||
import './search.js';
|
||||
import './top.js';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import { itunesFetch, formatDuration, formatDate } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import { itunesFetch } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
|
||||
// Apple Marketing Tools RSS API — public, no key required
|
||||
const CHARTS_URL = 'https://rss.marketingtools.apple.com/api/v2';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/iTuneSearchAPI/
|
||||
*/
|
||||
|
||||
import { CliError } from '../../errors.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
|
||||
const BASE = 'https://itunes.apple.com';
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import { arxivFetch, parseEntries } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import { arxivFetch, parseEntries } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
* https://info.arxiv.org/help/api/index.html
|
||||
*/
|
||||
|
||||
import { CliError } from '../../errors.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
|
||||
export const ARXIV_BASE = 'https://export.arxiv.org/api/query';
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { AuthRequiredError, EmptyResultError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { AuthRequiredError, EmptyResultError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
/**
|
||||
* band bands — List all Bands you belong to.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AuthRequiredError, EmptyResultError, SelectorError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { AuthRequiredError, EmptyResultError, SelectorError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
/**
|
||||
* band mentions — Show Band notifications where you were @mentioned.
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { AuthRequiredError, EmptyResultError } from '../../errors.js';
|
||||
import { AuthRequiredError, EmptyResultError } from '../../src/errors.js';
|
||||
import { formatCookieHeader } from '../../download/index.js';
|
||||
import { downloadMedia } from '../../download/media-download.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
/**
|
||||
* band post — Export full content of a Band post: body, comments, and optional photo download.
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { AuthRequiredError, EmptyResultError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { AuthRequiredError, EmptyResultError } from '../../src/errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
/**
|
||||
* band posts — List posts from a specific Band.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Shows high volume/OI ratio trades that may indicate institutional activity.
|
||||
* Auth: CSRF token from <meta name="csrf-token"> + session cookies.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
cli({
|
||||
site: 'barchart',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* for near-the-money options on a given symbol.
|
||||
* Auth: CSRF token from <meta name="csrf-token"> + session cookies.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
cli({
|
||||
site: 'barchart',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Barchart options chain — strike, bid/ask, volume, OI, greeks, IV.
|
||||
* Auth: CSRF token from <meta name="csrf-token"> + session cookies.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
cli({
|
||||
site: 'barchart',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Barchart stock quote — price, volume, market cap, P/E, EPS, and key metrics.
|
||||
* Auth: CSRF token from <meta name="csrf-token"> + session cookies.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
cli({
|
||||
site: 'barchart',
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BBC News headlines — public RSS feed, no browser needed.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
|
||||
cli({
|
||||
site: 'bbc',
|
||||
|
||||
@@ -9,7 +9,7 @@ vi.mock('./utils.js', async (importOriginal) => ({
|
||||
apiGet: mockApiGet,
|
||||
}));
|
||||
|
||||
import { getRegistry } from '../../registry.js';
|
||||
import { getRegistry } from '../../src/registry.js';
|
||||
import './comments.js';
|
||||
|
||||
describe('bilibili comments', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Uses the /x/v2/reply/main endpoint which is stable and doesn't depend on DOM structure.
|
||||
*/
|
||||
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet, resolveBvid } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* - yt-dlp must be installed: pip install yt-dlp
|
||||
*/
|
||||
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { checkYtdlp, sanitizeFilename } from '../../download/index.js';
|
||||
import { downloadMedia } from '../../download/media-download.js';
|
||||
import { resolveBvid } from './utils.js';
|
||||
|
||||
@@ -8,7 +8,7 @@ vi.mock('./utils.js', () => ({
|
||||
apiGet: mockApiGet,
|
||||
}));
|
||||
|
||||
import { getRegistry } from '../../registry.js';
|
||||
import { getRegistry } from '../../src/registry.js';
|
||||
import './dynamic.js';
|
||||
|
||||
describe('bilibili dynamic adapter', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet, payloadData, getSelfUid } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet, payloadData, getSelfUid, stripHtml } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CommandExecutionError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CommandExecutionError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { fetchJson, getSelfUid, resolveUid } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet, payloadData } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet, getSelfUid } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet, stripHtml } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { AuthRequiredError, EmptyResultError } from '../../errors.js';
|
||||
import { AuthRequiredError, EmptyResultError } from '../../src/errors.js';
|
||||
|
||||
const { mockApiGet } = vi.hoisted(() => ({
|
||||
mockApiGet: vi.fn(),
|
||||
@@ -11,7 +11,7 @@ vi.mock('./utils.js', async (importOriginal) => ({
|
||||
apiGet: mockApiGet,
|
||||
}));
|
||||
|
||||
import { getRegistry } from '../../registry.js';
|
||||
import { getRegistry } from '../../src/registry.js';
|
||||
import './subtitle.js';
|
||||
|
||||
describe('bilibili subtitle', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { AuthRequiredError, CommandExecutionError, EmptyResultError, SelectorError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { AuthRequiredError, CommandExecutionError, EmptyResultError, SelectorError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { apiGet, resolveBvid } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { apiGet, payloadData, resolveUid } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
import https from 'node:https';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { AuthRequiredError, EmptyResultError } from '../../errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { AuthRequiredError, EmptyResultError } from '../../src/errors.js';
|
||||
|
||||
/**
|
||||
* Resolve Bilibili short URL / short code to BV ID.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { BLOOMBERG_FEEDS } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CliError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
import {
|
||||
extractStoryMediaLinks,
|
||||
renderStoryBody,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { fetchBloombergFeed } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CliError } from '../../errors.js';
|
||||
import { CliError } from '../../src/errors.js';
|
||||
|
||||
export const BLOOMBERG_FEEDS = {
|
||||
main: 'https://feeds.bloomberg.com/news.rss',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 batchgreet — batch greet recommended candidates.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import {
|
||||
requirePage, navigateToChat, fetchRecommendList,
|
||||
clickCandidateInList, typeAndSendMessage, verbose,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, fetchFriendList } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, bossFetch, findFriendByUid } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 job detail — fetch full job posting details via browser cookie API.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateTo, bossFetch, verbose } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 exchange — request phone/wechat exchange with a candidate.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, bossFetch, findFriendByUid, verbose } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 greet — send greeting to a new candidate (initiate chat).
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import {
|
||||
requirePage, navigateToChat, findFriendByUid,
|
||||
clickCandidateInList, typeAndSendMessage, verbose,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 invite — send interview invitation to a candidate.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, bossFetch, findFriendByUid, verbose } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 job list — list my published jobs via boss API.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, bossFetch, verbose } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@
|
||||
* 1=新招呼, 2=沟通中, 3=已约面, 4=已获取简历, 5=已交换电话,
|
||||
* 6=已交换微信, 7=不合适, 8=牛人发起, 11=收藏
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, bossFetch, findFriendByUid, verbose } from './utils.js';
|
||||
import { ArgumentError, EmptyResultError } from '../../errors.js';
|
||||
import { ArgumentError, EmptyResultError } from '../../src/errors.js';
|
||||
|
||||
const LABEL_MAP: Record<string, number> = {
|
||||
'新招呼': 1, '沟通中': 2, '已约面': 3, '已获取简历': 4,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 recommend — view recommended candidates (新招呼/greet sort list).
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, bossFetch, fetchRecommendList, verbose } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
* .experience-content.detail-list → details (company·position / school·major·degree)
|
||||
* .position-content → job being discussed + expectation
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, findFriendByUid, clickCandidateInList } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 job search — browser cookie API.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateTo, bossFetch, assertOk, verbose } from './utils.js';
|
||||
|
||||
/** City name → BOSS Zhipin city code mapping */
|
||||
|
||||
+2
-2
@@ -4,12 +4,12 @@
|
||||
* BOSS chat uses MQTT (not HTTP) for messaging, so we must go through the UI
|
||||
* rather than making direct API calls.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import {
|
||||
requirePage, navigateToChat, findFriendByUid,
|
||||
clickCandidateInList, typeAndSendMessage,
|
||||
} from './utils.js';
|
||||
import { EmptyResultError, SelectorError } from '../../errors.js';
|
||||
import { EmptyResultError, SelectorError } from '../../src/errors.js';
|
||||
|
||||
cli({
|
||||
site: 'boss',
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BOSS直聘 stats — job statistics overview.
|
||||
*/
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { requirePage, navigateToChat, bossFetch, fetchFriendList, verbose } from './utils.js';
|
||||
|
||||
cli({
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
* - Cookie expiry error codes (code 7, 37)
|
||||
* - Verbose logging
|
||||
*/
|
||||
import type { IPage } from '../../types.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
// ── Constants ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { AuthRequiredError } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { AuthRequiredError } from '../../src/errors.js';
|
||||
import {
|
||||
getCourses, initSession, enterCourse, getTabIframeUrl,
|
||||
parseAssignmentsFromDom, sleep,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import {
|
||||
getCourses, initSession, enterCourse, getTabIframeUrl,
|
||||
parseExamsFromDom, sleep,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* course pages loaded as iframes.
|
||||
*/
|
||||
|
||||
import type { IPage } from '../../types.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
// ── Utilities ────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { execSync, spawnSync } from 'node:child_process';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { ConfigError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { ConfigError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { activateChatGPT, getVisibleChatMessages, selectModel, MODEL_CHOICES, isGenerating } from './ax.js';
|
||||
|
||||
export const askCommand = cli({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { ConfigError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { ConfigError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { activateChatGPT, selectModel, MODEL_CHOICES } from './ax.js';
|
||||
|
||||
export const modelCommand = cli({
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { ConfigError, getErrorMessage } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { ConfigError, getErrorMessage } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const newCommand = cli({
|
||||
site: 'chatgpt',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CommandExecutionError, ConfigError, getErrorMessage } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CommandExecutionError, ConfigError, getErrorMessage } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { getVisibleChatMessages } from './ax.js';
|
||||
|
||||
export const readCommand = cli({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { execSync, spawnSync } from 'node:child_process';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { getErrorMessage } from '../../errors.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
import { getErrorMessage } from '../../src/errors.js';
|
||||
import { activateChatGPT, selectModel, MODEL_CHOICES } from './ax.js';
|
||||
|
||||
export const sendCommand = cli({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { CommandExecutionError, ConfigError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { CommandExecutionError, ConfigError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const statusCommand = cli({
|
||||
site: 'chatgpt',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { SelectorError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { SelectorError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const askCommand = cli({
|
||||
site: 'chatwise',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as fs from 'node:fs';
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const exportCommand = cli({
|
||||
site: 'chatwise',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const historyCommand = cli({
|
||||
site: 'chatwise',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cli, Strategy } from '../../registry.js';
|
||||
import { SelectorError } from '../../errors.js';
|
||||
import type { IPage } from '../../types.js';
|
||||
import { cli, Strategy } from '../../src/registry.js';
|
||||
import { SelectorError } from '../../src/errors.js';
|
||||
import type { IPage } from '../../src/types.js';
|
||||
|
||||
export const modelCommand = cli({
|
||||
site: 'chatwise',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user