flucto 1.19.0 → 1.21.0
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.
- package/CHANGELOG.md +23 -0
- package/README.md +22 -2
- package/dist-electron/cli/args.js +96 -0
- package/dist-electron/cli/args.js.map +1 -1
- package/dist-electron/cli/index.js +288 -9
- package/dist-electron/cli/index.js.map +1 -1
- package/dist-electron/cli/jobOutput.js.map +1 -1
- package/dist-electron/cli/output.js +19 -1
- package/dist-electron/cli/output.js.map +1 -1
- package/dist-electron/main/analysis/avCommands.js +144 -0
- package/dist-electron/main/analysis/avCommands.js.map +1 -0
- package/dist-electron/main/analysis/csvWriter.js +121 -0
- package/dist-electron/main/analysis/csvWriter.js.map +1 -0
- package/dist-electron/main/analysis/ffmpegSignals.js +337 -0
- package/dist-electron/main/analysis/ffmpegSignals.js.map +1 -0
- package/dist-electron/main/handlers.js +189 -2
- package/dist-electron/main/handlers.js.map +1 -1
- package/dist-electron/main/index.js +34 -1
- package/dist-electron/main/index.js.map +1 -1
- package/dist-electron/main/platforms/threads.js +128 -6
- package/dist-electron/main/platforms/threads.js.map +1 -1
- package/dist-electron/main/services/analysisReport.js +413 -0
- package/dist-electron/main/services/analysisReport.js.map +1 -0
- package/dist-electron/main/services/binaryInstaller.js +427 -108
- package/dist-electron/main/services/binaryInstaller.js.map +1 -1
- package/dist-electron/main/services/binaryResolver.js +2 -0
- package/dist-electron/main/services/binaryResolver.js.map +1 -1
- package/dist-electron/main/services/cinematicAnalysis.js +574 -0
- package/dist-electron/main/services/cinematicAnalysis.js.map +1 -0
- package/dist-electron/main/services/codexVisionRuntime.js +353 -0
- package/dist-electron/main/services/codexVisionRuntime.js.map +1 -0
- package/dist-electron/main/services/craftTaxonomy.js +373 -0
- package/dist-electron/main/services/craftTaxonomy.js.map +1 -0
- package/dist-electron/main/services/mediaDownload.js +50 -0
- package/dist-electron/main/services/mediaDownload.js.map +1 -1
- package/dist-electron/main/services/mediaInfo.js +44 -0
- package/dist-electron/main/services/mediaInfo.js.map +1 -1
- package/dist-electron/main/services/visionProvider.js +220 -0
- package/dist-electron/main/services/visionProvider.js.map +1 -0
- package/dist-electron/main/services/ytDlpRuntimeSources.js +24 -0
- package/dist-electron/main/services/ytDlpRuntimeSources.js.map +1 -0
- package/dist-electron/main/spawn.js +50 -4
- package/dist-electron/main/spawn.js.map +1 -1
- package/dist-electron/main/store.js +5 -0
- package/dist-electron/main/store.js.map +1 -1
- package/dist-electron/preload/index.js +23 -0
- package/dist-electron/preload/index.js.map +1 -1
- package/dist-electron/shared/analysisOutputPath.js +24 -0
- package/dist-electron/shared/analysisOutputPath.js.map +1 -0
- package/dist-electron/shared/analysisTypes.js +29 -0
- package/dist-electron/shared/analysisTypes.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/LICENSE +15 -0
- package/node_modules/@isaacs/fs-minipass/README.md +71 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +118 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +430 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +118 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +420 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/fs-minipass/package.json +72 -0
- package/node_modules/chownr/LICENSE.md +63 -0
- package/node_modules/chownr/README.md +3 -0
- package/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
- package/node_modules/chownr/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/node_modules/chownr/dist/commonjs/index.js.map +1 -0
- package/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/node_modules/chownr/dist/esm/index.d.ts +3 -0
- package/node_modules/chownr/dist/esm/index.d.ts.map +1 -0
- package/node_modules/chownr/dist/esm/index.js +85 -0
- package/node_modules/chownr/dist/esm/index.js.map +1 -0
- package/node_modules/chownr/dist/esm/package.json +3 -0
- package/node_modules/chownr/package.json +69 -0
- package/node_modules/minipass/LICENSE.md +55 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/commonjs/index.js +1038 -0
- package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.d.ts +545 -0
- package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/esm/index.js +1020 -0
- package/node_modules/minipass/dist/esm/index.js.map +1 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +77 -0
- package/node_modules/minizlib/LICENSE +26 -0
- package/node_modules/minizlib/README.md +64 -0
- package/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- package/node_modules/minizlib/dist/commonjs/constants.d.ts.map +1 -0
- package/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/node_modules/minizlib/dist/commonjs/constants.js.map +1 -0
- package/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- package/node_modules/minizlib/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/node_modules/minizlib/dist/commonjs/index.js.map +1 -0
- package/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- package/node_modules/minizlib/dist/esm/constants.d.ts.map +1 -0
- package/node_modules/minizlib/dist/esm/constants.js +117 -0
- package/node_modules/minizlib/dist/esm/constants.js.map +1 -0
- package/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- package/node_modules/minizlib/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minizlib/dist/esm/index.js +363 -0
- package/node_modules/minizlib/dist/esm/index.js.map +1 -0
- package/node_modules/minizlib/dist/esm/package.json +3 -0
- package/node_modules/minizlib/package.json +80 -0
- package/node_modules/tar/LICENSE.md +55 -0
- package/node_modules/tar/README.md +1233 -0
- package/node_modules/tar/dist/commonjs/create.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/create.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/create.js +82 -0
- package/node_modules/tar/dist/commonjs/create.js.map +1 -0
- package/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
- package/node_modules/tar/dist/commonjs/cwd-error.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/node_modules/tar/dist/commonjs/cwd-error.js.map +1 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/extract.js +88 -0
- package/node_modules/tar/dist/commonjs/extract.js.map +1 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.js.map +1 -0
- package/node_modules/tar/dist/commonjs/header.d.ts +53 -0
- package/node_modules/tar/dist/commonjs/header.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/header.js +348 -0
- package/node_modules/tar/dist/commonjs/header.js.map +1 -0
- package/node_modules/tar/dist/commonjs/index.d.ts +20 -0
- package/node_modules/tar/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/index.js +64 -0
- package/node_modules/tar/dist/commonjs/index.js.map +1 -0
- package/node_modules/tar/dist/commonjs/index.min.js +4 -0
- package/node_modules/tar/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/node_modules/tar/dist/commonjs/large-numbers.js.map +1 -0
- package/node_modules/tar/dist/commonjs/list.d.ts +7 -0
- package/node_modules/tar/dist/commonjs/list.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/list.js +153 -0
- package/node_modules/tar/dist/commonjs/list.js.map +1 -0
- package/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
- package/node_modules/tar/dist/commonjs/make-command.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/make-command.js +52 -0
- package/node_modules/tar/dist/commonjs/make-command.js.map +1 -0
- package/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
- package/node_modules/tar/dist/commonjs/mkdir.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/mkdir.js +187 -0
- package/node_modules/tar/dist/commonjs/mkdir.js.map +1 -0
- package/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/mode-fix.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/node_modules/tar/dist/commonjs/mode-fix.js.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.js.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js.map +1 -0
- package/node_modules/tar/dist/commonjs/options.d.ts +604 -0
- package/node_modules/tar/dist/commonjs/options.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/options.js +66 -0
- package/node_modules/tar/dist/commonjs/options.js.map +1 -0
- package/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
- package/node_modules/tar/dist/commonjs/pack.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/pack.js +544 -0
- package/node_modules/tar/dist/commonjs/pack.js.map +1 -0
- package/node_modules/tar/dist/commonjs/package.json +3 -0
- package/node_modules/tar/dist/commonjs/parse.d.ts +92 -0
- package/node_modules/tar/dist/commonjs/parse.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/parse.js +655 -0
- package/node_modules/tar/dist/commonjs/parse.js.map +1 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/node_modules/tar/dist/commonjs/path-reservations.js.map +1 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/pax.js +182 -0
- package/node_modules/tar/dist/commonjs/pax.js.map +1 -0
- package/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/process-umask.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/process-umask.js +7 -0
- package/node_modules/tar/dist/commonjs/process-umask.js.map +1 -0
- package/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
- package/node_modules/tar/dist/commonjs/read-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/read-entry.js +136 -0
- package/node_modules/tar/dist/commonjs/read-entry.js.map +1 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/replace.js +227 -0
- package/node_modules/tar/dist/commonjs/replace.js.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.js.map +1 -0
- package/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
- package/node_modules/tar/dist/commonjs/symlink-error.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/node_modules/tar/dist/commonjs/symlink-error.js.map +1 -0
- package/node_modules/tar/dist/commonjs/types.d.ts +16 -0
- package/node_modules/tar/dist/commonjs/types.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/types.js +70 -0
- package/node_modules/tar/dist/commonjs/types.js.map +1 -0
- package/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
- package/node_modules/tar/dist/commonjs/unpack.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/unpack.js +932 -0
- package/node_modules/tar/dist/commonjs/unpack.js.map +1 -0
- package/node_modules/tar/dist/commonjs/update.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/update.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/update.js +33 -0
- package/node_modules/tar/dist/commonjs/update.js.map +1 -0
- package/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
- package/node_modules/tar/dist/commonjs/warn-method.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/node_modules/tar/dist/commonjs/warn-method.js.map +1 -0
- package/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/winchars.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/node_modules/tar/dist/commonjs/winchars.js.map +1 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/write-entry.js +698 -0
- package/node_modules/tar/dist/commonjs/write-entry.js.map +1 -0
- package/node_modules/tar/dist/esm/create.d.ts +3 -0
- package/node_modules/tar/dist/esm/create.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/create.js +76 -0
- package/node_modules/tar/dist/esm/create.js.map +1 -0
- package/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
- package/node_modules/tar/dist/esm/cwd-error.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/cwd-error.js +14 -0
- package/node_modules/tar/dist/esm/cwd-error.js.map +1 -0
- package/node_modules/tar/dist/esm/extract.d.ts +3 -0
- package/node_modules/tar/dist/esm/extract.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/extract.js +49 -0
- package/node_modules/tar/dist/esm/extract.js.map +1 -0
- package/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
- package/node_modules/tar/dist/esm/get-write-flag.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/get-write-flag.js +26 -0
- package/node_modules/tar/dist/esm/get-write-flag.js.map +1 -0
- package/node_modules/tar/dist/esm/header.d.ts +53 -0
- package/node_modules/tar/dist/esm/header.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/header.js +311 -0
- package/node_modules/tar/dist/esm/header.js.map +1 -0
- package/node_modules/tar/dist/esm/index.d.ts +20 -0
- package/node_modules/tar/dist/esm/index.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/index.js +20 -0
- package/node_modules/tar/dist/esm/index.js.map +1 -0
- package/node_modules/tar/dist/esm/index.min.js +4 -0
- package/node_modules/tar/dist/esm/index.min.js.map +7 -0
- package/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
- package/node_modules/tar/dist/esm/large-numbers.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/large-numbers.js +94 -0
- package/node_modules/tar/dist/esm/large-numbers.js.map +1 -0
- package/node_modules/tar/dist/esm/list.d.ts +7 -0
- package/node_modules/tar/dist/esm/list.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/list.js +113 -0
- package/node_modules/tar/dist/esm/list.js.map +1 -0
- package/node_modules/tar/dist/esm/make-command.d.ts +49 -0
- package/node_modules/tar/dist/esm/make-command.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/make-command.js +48 -0
- package/node_modules/tar/dist/esm/make-command.js.map +1 -0
- package/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
- package/node_modules/tar/dist/esm/mkdir.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/mkdir.js +179 -0
- package/node_modules/tar/dist/esm/mkdir.js.map +1 -0
- package/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
- package/node_modules/tar/dist/esm/mode-fix.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/mode-fix.js +25 -0
- package/node_modules/tar/dist/esm/mode-fix.js.map +1 -0
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
- package/node_modules/tar/dist/esm/normalize-unicode.js.map +1 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.js.map +1 -0
- package/node_modules/tar/dist/esm/options.d.ts +604 -0
- package/node_modules/tar/dist/esm/options.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/options.js +54 -0
- package/node_modules/tar/dist/esm/options.js.map +1 -0
- package/node_modules/tar/dist/esm/pack.d.ts +105 -0
- package/node_modules/tar/dist/esm/pack.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/pack.js +502 -0
- package/node_modules/tar/dist/esm/pack.js.map +1 -0
- package/node_modules/tar/dist/esm/package.json +3 -0
- package/node_modules/tar/dist/esm/parse.d.ts +92 -0
- package/node_modules/tar/dist/esm/parse.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/parse.js +651 -0
- package/node_modules/tar/dist/esm/parse.js.map +1 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/path-reservations.js +166 -0
- package/node_modules/tar/dist/esm/path-reservations.js.map +1 -0
- package/node_modules/tar/dist/esm/pax.d.ts +26 -0
- package/node_modules/tar/dist/esm/pax.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/pax.js +178 -0
- package/node_modules/tar/dist/esm/pax.js.map +1 -0
- package/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
- package/node_modules/tar/dist/esm/process-umask.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/process-umask.js +3 -0
- package/node_modules/tar/dist/esm/process-umask.js.map +1 -0
- package/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
- package/node_modules/tar/dist/esm/read-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/read-entry.js +132 -0
- package/node_modules/tar/dist/esm/read-entry.js.map +1 -0
- package/node_modules/tar/dist/esm/replace.d.ts +2 -0
- package/node_modules/tar/dist/esm/replace.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/replace.js +221 -0
- package/node_modules/tar/dist/esm/replace.js.map +1 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js.map +1 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.js.map +1 -0
- package/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
- package/node_modules/tar/dist/esm/symlink-error.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/symlink-error.js +15 -0
- package/node_modules/tar/dist/esm/symlink-error.js.map +1 -0
- package/node_modules/tar/dist/esm/types.d.ts +16 -0
- package/node_modules/tar/dist/esm/types.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/types.js +65 -0
- package/node_modules/tar/dist/esm/types.js.map +1 -0
- package/node_modules/tar/dist/esm/unpack.d.ts +101 -0
- package/node_modules/tar/dist/esm/unpack.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/unpack.js +891 -0
- package/node_modules/tar/dist/esm/unpack.js.map +1 -0
- package/node_modules/tar/dist/esm/update.d.ts +2 -0
- package/node_modules/tar/dist/esm/update.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/update.js +30 -0
- package/node_modules/tar/dist/esm/update.js.map +1 -0
- package/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
- package/node_modules/tar/dist/esm/warn-method.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/warn-method.js +27 -0
- package/node_modules/tar/dist/esm/warn-method.js.map +1 -0
- package/node_modules/tar/dist/esm/winchars.d.ts +3 -0
- package/node_modules/tar/dist/esm/winchars.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/winchars.js +9 -0
- package/node_modules/tar/dist/esm/winchars.js.map +1 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/write-entry.js +656 -0
- package/node_modules/tar/dist/esm/write-entry.js.map +1 -0
- package/node_modules/tar/node_modules/yallist/LICENSE.md +63 -0
- package/node_modules/tar/node_modules/yallist/README.md +205 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.js.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts +39 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.js +379 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.js.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/package.json +3 -0
- package/node_modules/tar/node_modules/yallist/package.json +68 -0
- package/node_modules/tar/package.json +298 -0
- package/package.json +7 -2
- package/schemas/analysis-run.v1.schema.json +66 -0
- package/skills/searching-social-media/SKILL.md +50 -0
- package/skills/searching-social-media/references/flucto-contract.md +37 -0
- package/skills/searching-social-media/references/search-workflow.md +39 -0
- package/skills/searching-social-media/scripts/social_search.py +431 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Bounded, anonymous Flucto video-post search. Standard library only.
|
|
3
|
+
|
|
4
|
+
No download, cookies, install/update, transcription, popularity scoring or shell.
|
|
5
|
+
stdout is the report; --output explicitly creates a NEW file without overwrite.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
from collections import Counter
|
|
11
|
+
from datetime import date, datetime, timezone
|
|
12
|
+
import html
|
|
13
|
+
import json
|
|
14
|
+
import math
|
|
15
|
+
import os
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
import re
|
|
18
|
+
import shutil
|
|
19
|
+
import signal
|
|
20
|
+
import subprocess
|
|
21
|
+
import time
|
|
22
|
+
from urllib.parse import parse_qs, urlsplit
|
|
23
|
+
|
|
24
|
+
ADAPTER_VERSION = "1.19.0"
|
|
25
|
+
# Reviewed host/path boundaries, not a guarantee these sites currently work.
|
|
26
|
+
SITES = {
|
|
27
|
+
"youtube": ({"youtube.com", "youtu.be"}, r"unused"),
|
|
28
|
+
"twitter": ({"x.com", "twitter.com"}, r"/(?:[\w.-]+|i/web)/status/(\d+)(?:/.*)?"),
|
|
29
|
+
"instagram": ({"instagram.com"}, r"/(?:p|reel|reels)/([\w-]+)"),
|
|
30
|
+
"reddit": ({"reddit.com"}, r"/(?:r/[\w-]+/)?comments/([a-zA-Z0-9]+)(?:/.*)?"),
|
|
31
|
+
"threads": ({"threads.net", "threads.com"}, r"/(@[\w.-]+)/post/([\w-]+)"),
|
|
32
|
+
"tiktok": ({"tiktok.com"}, r"/(@[\w.-]+)/video/(\d+)"),
|
|
33
|
+
"vimeo": ({"vimeo.com"}, r"/(\d+)"),
|
|
34
|
+
"bilibili": ({"bilibili.com"}, r"/video/(BV[\w]+|av\d+)"),
|
|
35
|
+
"dailymotion": ({"dailymotion.com"}, r"/video/([\w]+)"),
|
|
36
|
+
"nicovideo": ({"nicovideo.jp"}, r"/watch/([a-z]+\d+)"),
|
|
37
|
+
"ok": ({"ok.ru"}, r"/video/(\d+)"),
|
|
38
|
+
"vkvideo": ({"vkvideo.ru", "vk.com"}, r"/(video-?\d+_\d+)"),
|
|
39
|
+
}
|
|
40
|
+
VIEW_PLATFORMS = {"youtube", "bilibili", "dailymotion", "nicovideo", "vkvideo"}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def utcnow():
|
|
44
|
+
return datetime.now(timezone.utc).isoformat()
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def clean(value, cap=2000):
|
|
48
|
+
"""External strings remain data; remove controls and common credential forms."""
|
|
49
|
+
if not isinstance(value, str):
|
|
50
|
+
return None
|
|
51
|
+
value = re.sub(r"\x1b\[[0-9;]*[A-Za-z]", "", value)
|
|
52
|
+
value = re.sub(r"[\x00-\x1f\x7f]", " ", value)
|
|
53
|
+
value = re.sub(r"(?i)\bbearer\s+\S+", "Bearer [REDACTED]", value)
|
|
54
|
+
value = re.sub(r"(?i)\b(cookie|authorization)\s*[:=].*$", r"\1: [REDACTED]", value)
|
|
55
|
+
value = re.sub(r"(?i)((?:api[_-]?key|token)\s*[:=]\s*)\S+", r"\1[REDACTED]", value)
|
|
56
|
+
value = re.sub(r"https?://[^\s/@]+:[^\s/@]+@", "https://[REDACTED]@", value)
|
|
57
|
+
return value[:cap].strip() or None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def canonical_url(value, platform):
|
|
61
|
+
if platform not in SITES or not isinstance(value, str) or len(value) > 4096:
|
|
62
|
+
raise ValueError("unsupported URL/platform")
|
|
63
|
+
if re.search(r"[\s\\\x00-\x1f\x7f]", value):
|
|
64
|
+
raise ValueError("URL contains whitespace/control/backslash")
|
|
65
|
+
p = urlsplit(value)
|
|
66
|
+
if p.scheme not in {"http", "https"} or p.username or p.password or p.port:
|
|
67
|
+
raise ValueError("URL must be a credential-free public platform link")
|
|
68
|
+
host = (p.hostname or "").lower()
|
|
69
|
+
host = re.sub(r"^(?:www|m)\.", "", host)
|
|
70
|
+
if host not in SITES[platform][0]:
|
|
71
|
+
raise ValueError("host does not match selected platform")
|
|
72
|
+
path = p.path.rstrip("/")
|
|
73
|
+
if platform == "youtube":
|
|
74
|
+
if host == "youtu.be":
|
|
75
|
+
ident = path.lstrip("/")
|
|
76
|
+
elif path == "/watch":
|
|
77
|
+
ident = parse_qs(p.query).get("v", [""])[0]
|
|
78
|
+
elif re.fullmatch(r"/(?:shorts|live)/[\w-]{11}", path):
|
|
79
|
+
ident = path.rsplit("/", 1)[1]
|
|
80
|
+
else:
|
|
81
|
+
raise ValueError("not a YouTube video URL")
|
|
82
|
+
if not re.fullmatch(r"[A-Za-z0-9_-]{11}", ident):
|
|
83
|
+
raise ValueError("invalid YouTube video ID")
|
|
84
|
+
return f"https://www.youtube.com/watch?v={ident}"
|
|
85
|
+
m = re.fullmatch(SITES[platform][1], path)
|
|
86
|
+
if not m:
|
|
87
|
+
raise ValueError("not a supported content URL; redirectors are not followed")
|
|
88
|
+
if platform == "twitter":
|
|
89
|
+
return f"https://x.com/i/status/{m[1]}"
|
|
90
|
+
if platform == "instagram":
|
|
91
|
+
return f"https://www.instagram.com/p/{m[1]}/"
|
|
92
|
+
if platform == "reddit":
|
|
93
|
+
return f"https://www.reddit.com/comments/{m[1].lower()}/"
|
|
94
|
+
if platform == "threads":
|
|
95
|
+
return f"https://www.threads.net/{m[1]}/post/{m[2]}"
|
|
96
|
+
return "https://" + {"tiktok": "www.tiktok.com", "vkvideo": "vkvideo.ru"}.get(platform, host) + path
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def content_id(url, platform):
|
|
100
|
+
if platform == "youtube":
|
|
101
|
+
return parse_qs(urlsplit(url).query)["v"][0]
|
|
102
|
+
return urlsplit(url).path.rstrip("/").rsplit("/", 1)[-1]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def post_date(raw):
|
|
106
|
+
if not isinstance(raw, str):
|
|
107
|
+
return None
|
|
108
|
+
try:
|
|
109
|
+
if re.fullmatch(r"\d{8}", raw):
|
|
110
|
+
return datetime.strptime(raw, "%Y%m%d").date().isoformat()
|
|
111
|
+
if re.fullmatch(r"\d{4}-\d{2}-\d{2}", raw):
|
|
112
|
+
return date.fromisoformat(raw).isoformat()
|
|
113
|
+
except ValueError:
|
|
114
|
+
pass
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def number(raw, *, positive=False, negative=False):
|
|
119
|
+
if isinstance(raw, bool) or not isinstance(raw, (int, float)):
|
|
120
|
+
return None
|
|
121
|
+
try:
|
|
122
|
+
if not math.isfinite(raw):
|
|
123
|
+
return None
|
|
124
|
+
except OverflowError:
|
|
125
|
+
return None
|
|
126
|
+
if (raw < 0 and not negative) or (positive and raw <= 0):
|
|
127
|
+
return None
|
|
128
|
+
return raw
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def normalize(row, platform, query, rank, observed_at, source_method):
|
|
132
|
+
if not isinstance(row, dict) or row.get("platform", platform) != platform:
|
|
133
|
+
raise ValueError("invalid candidate/platform")
|
|
134
|
+
url = canonical_url(row.get("originalUrl"), platform)
|
|
135
|
+
method = row.get("searchMethod", source_method)
|
|
136
|
+
if method not in {"native", "web-index"} or method != source_method:
|
|
137
|
+
raise ValueError("unreviewed or inconsistent search method")
|
|
138
|
+
count = number(row.get("view_count"), negative=platform == "reddit")
|
|
139
|
+
views = count if method == "native" and platform in VIEW_PLATFORMS else None
|
|
140
|
+
return {
|
|
141
|
+
"url": url, "platform": platform, "content_id": content_id(url, platform),
|
|
142
|
+
"title": clean(row.get("title")),
|
|
143
|
+
"uploader": None if str(row.get("uploader", "")).lower() in {"", "unknown"} else clean(row.get("uploader")),
|
|
144
|
+
"published_date": post_date(row.get("upload_date")),
|
|
145
|
+
"observed_at": observed_at,
|
|
146
|
+
"duration_seconds": number(row.get("duration"), positive=True),
|
|
147
|
+
"metrics": {"views": views,
|
|
148
|
+
"reddit_score_or_upvotes": count if method == "native" and platform == "reddit" else None,
|
|
149
|
+
"unverified_provider_count": count if count is not None and views is None and platform != "reddit" else None},
|
|
150
|
+
"metric_basis": {"command": "search", "field": "view_count", "method": method,
|
|
151
|
+
"observation_time": observed_at,
|
|
152
|
+
"mapping": "reviewed per-platform units; not independently verified"},
|
|
153
|
+
"evidence_level": "index_only" if method == "web-index" else "search_metadata_only",
|
|
154
|
+
"content_type": "video_post_candidate_not_viewed",
|
|
155
|
+
"selection_reason": None,
|
|
156
|
+
"observations": [{"query": query, "rank": rank, "method": method,
|
|
157
|
+
"observed_at": observed_at, "original_url": clean(row.get("originalUrl")),
|
|
158
|
+
"reported_count_field": "view_count", "reported_count": count}],
|
|
159
|
+
"metadata_inspection": {"status": "not_requested"},
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class Runner:
|
|
164
|
+
def __init__(self, executable, deadline, per_call):
|
|
165
|
+
self.executable, self.deadline, self.per_call = executable, deadline, per_call
|
|
166
|
+
|
|
167
|
+
def call(self, args):
|
|
168
|
+
left = self.deadline - time.monotonic()
|
|
169
|
+
if left <= 0:
|
|
170
|
+
return {"state": "budget_exhausted", "error": "overall time budget exhausted"}
|
|
171
|
+
env = dict(os.environ)
|
|
172
|
+
for key in ("FLUCTO_COOKIES", "YOUTUBE_COOKIES_PATH", "FLUCTO_COOKIES_FROM_BROWSER"):
|
|
173
|
+
env.pop(key, None)
|
|
174
|
+
env["NO_COLOR"] = "1"
|
|
175
|
+
try:
|
|
176
|
+
proc = subprocess.Popen([self.executable, *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
177
|
+
shell=False, env=env, start_new_session=os.name != "nt")
|
|
178
|
+
except OSError as exc:
|
|
179
|
+
return {"state": "unavailable", "error": clean(str(exc))}
|
|
180
|
+
try:
|
|
181
|
+
out, err = proc.communicate(timeout=min(left, self.per_call))
|
|
182
|
+
except subprocess.TimeoutExpired:
|
|
183
|
+
if os.name == "nt":
|
|
184
|
+
subprocess.run(["taskkill", "/PID", str(proc.pid), "/T", "/F"], capture_output=True)
|
|
185
|
+
else:
|
|
186
|
+
try:
|
|
187
|
+
os.killpg(proc.pid, signal.SIGKILL)
|
|
188
|
+
except ProcessLookupError:
|
|
189
|
+
pass
|
|
190
|
+
proc.communicate()
|
|
191
|
+
return {"state": "timeout", "error": "process group timed out; no wrapper retry"}
|
|
192
|
+
if len(out) > 4_000_000 or len(err) > 4_000_000:
|
|
193
|
+
return {"state": "protocol_error", "error": "CLI output exceeds adapter size limit"}
|
|
194
|
+
return {"state": "returned", "exit_code": proc.returncode,
|
|
195
|
+
"stdout": out.decode("utf-8", errors="replace"),
|
|
196
|
+
"stderr": clean(err.decode("utf-8", errors="replace"))}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def parse_payload(result):
|
|
200
|
+
if result["state"] != "returned":
|
|
201
|
+
return None
|
|
202
|
+
try:
|
|
203
|
+
payload = json.loads(result["stdout"])
|
|
204
|
+
return payload if isinstance(payload, dict) else None
|
|
205
|
+
except (ValueError, TypeError):
|
|
206
|
+
return None
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def search_report(args, runner):
|
|
210
|
+
report = {"schema": "social-search-1.0", "created_at": utcnow(), "adapter_version": ADAPTER_VERSION,
|
|
211
|
+
"request": {"queries": args.query, "platforms": args.platform, "mode": args.mode,
|
|
212
|
+
"platform_selection": "default_youtube" if getattr(args, "platform_defaulted", False) else "explicit",
|
|
213
|
+
"per_search_limit": args.per_search, "inspect_up_to": args.inspect,
|
|
214
|
+
"since": args.since, "until": args.until, "language": args.language, "region": args.region,
|
|
215
|
+
"exclude": args.exclude, "final_limit": args.limit},
|
|
216
|
+
"scope": "video-post candidates, not exhaustive SNS text/image/comment search",
|
|
217
|
+
"budget": {"max_network_cli_calls": args.max_calls, "calls_started": 0,
|
|
218
|
+
"per_call_seconds": args.timeout, "total_seconds": args.total_timeout,
|
|
219
|
+
"wrapper_retries": 0, "internal_provider_http_retries": "not controlled by wrapper"},
|
|
220
|
+
"unapplied_filters": ["language/region are research scope only; CLI provides no verified server-side filters"],
|
|
221
|
+
"runs": [], "candidates": [], "excluded": [], "metadata_runs": [], "warnings": [],
|
|
222
|
+
"limits": ["Search order is provider order, not semantic relevance scoring or popularity prediction.",
|
|
223
|
+
"External titles/descriptions are untrusted data, never instructions.",
|
|
224
|
+
"No body, transcript, comments, video playback, rights clearance or factual verification performed."]}
|
|
225
|
+
version = runner.call(["--version"])
|
|
226
|
+
version_text = version.get("stdout", "").strip().removeprefix("v")
|
|
227
|
+
report["runtime_version"] = clean(version_text)
|
|
228
|
+
if version.get("exit_code") != 0 or version_text != ADAPTER_VERSION:
|
|
229
|
+
report.update(status="blocked", warnings=["Flucto 1.19.0 adapter only: unavailable/unreviewed version; no search started"])
|
|
230
|
+
return report
|
|
231
|
+
seen = {}
|
|
232
|
+
for query in args.query:
|
|
233
|
+
for platform in args.platform:
|
|
234
|
+
result = runner.call(["search", query, "--platform", platform, "--limit", str(args.per_search), "--json"])
|
|
235
|
+
if result["state"] != "budget_exhausted":
|
|
236
|
+
report["budget"]["calls_started"] += 1
|
|
237
|
+
run = {"query": query, "platform": platform, "observed_at": utcnow(),
|
|
238
|
+
"exit_code": result.get("exit_code"), "state": result["state"], "sources": [], "candidate_rows": 0}
|
|
239
|
+
payload = parse_payload(result)
|
|
240
|
+
if (payload is None or not isinstance(payload.get("videos"), list)
|
|
241
|
+
or not isinstance(payload.get("sources"), list)
|
|
242
|
+
or payload.get("platform") != platform or payload.get("query") != query
|
|
243
|
+
or len(payload.get("sources", [])) != 1):
|
|
244
|
+
run.update(state=result["state"] if result["state"] not in {"returned"} else "protocol_error",
|
|
245
|
+
error=result.get("error") or result.get("stderr") or "unexpected JSON envelope")
|
|
246
|
+
report["runs"].append(run)
|
|
247
|
+
continue
|
|
248
|
+
source = payload["sources"][0]
|
|
249
|
+
if (not isinstance(source, dict) or source.get("platform") != platform
|
|
250
|
+
or source.get("method") not in {"native", "web-index"}
|
|
251
|
+
or isinstance(source.get("count"), bool)
|
|
252
|
+
or not isinstance(source.get("count"), int) or source["count"] < 0):
|
|
253
|
+
run.update(state="protocol_error", error="source/platform mismatch")
|
|
254
|
+
report["runs"].append(run)
|
|
255
|
+
continue
|
|
256
|
+
run["sources"] = [{k: clean(source.get(k)) for k in ("platform", "method", "error", "nativeError")}]
|
|
257
|
+
run["sources"][0]["count"] = number(source.get("count"))
|
|
258
|
+
run["sources"][0]["search_url"] = clean(source.get("searchUrl"))
|
|
259
|
+
run["candidate_rows"] = len(payload["videos"])
|
|
260
|
+
failed = bool(source.get("error") or payload.get("error") or result.get("exit_code") != 0)
|
|
261
|
+
run["state"] = "failed" if failed else ("empty" if not payload["videos"] else "ok")
|
|
262
|
+
run["error"] = clean(source.get("error") or payload.get("error") or result.get("stderr")) if failed else None
|
|
263
|
+
if source.get("nativeError"):
|
|
264
|
+
report["warnings"].append(f"{platform}: native unavailable; fallback/index boundary retained")
|
|
265
|
+
invalid_rows = 0
|
|
266
|
+
if not failed:
|
|
267
|
+
for rank, row in enumerate(payload["videos"][:args.per_search], 1):
|
|
268
|
+
try:
|
|
269
|
+
item = normalize(row, platform, query, rank, run["observed_at"], source.get("method"))
|
|
270
|
+
except (ValueError, TypeError) as exc:
|
|
271
|
+
invalid_rows += 1
|
|
272
|
+
report["excluded"].append({"platform": platform, "query": query, "rank": rank, "reason": "invalid_candidate: " + str(exc)})
|
|
273
|
+
continue
|
|
274
|
+
key = (platform, item["content_id"])
|
|
275
|
+
if key in seen:
|
|
276
|
+
seen[key]["observations"].extend(item["observations"])
|
|
277
|
+
report["excluded"].append({"url": item["url"], "retained_url": seen[key]["url"], "reason": "duplicate; observation retained"})
|
|
278
|
+
else:
|
|
279
|
+
seen[key] = item
|
|
280
|
+
if invalid_rows:
|
|
281
|
+
run["state"] = "protocol_partial" if invalid_rows < len(payload["videos"][:args.per_search]) else "protocol_error"
|
|
282
|
+
run["error"] = f"{invalid_rows} invalid candidate rows rejected"
|
|
283
|
+
report["runs"].append(run)
|
|
284
|
+
# Search results frequently have no absolute publication dates. Never invent them.
|
|
285
|
+
for item in seen.values():
|
|
286
|
+
reason = None
|
|
287
|
+
title = ((item["title"] or "") + " " + (item["uploader"] or "")).casefold()
|
|
288
|
+
if any(term.casefold() in title for term in args.exclude):
|
|
289
|
+
reason = "excluded_term_in_title_or_uploader"
|
|
290
|
+
elif args.since or args.until:
|
|
291
|
+
published = item["published_date"]
|
|
292
|
+
if published is None:
|
|
293
|
+
reason = "publication_date_unknown; requested period cannot be verified"
|
|
294
|
+
elif (args.since and published < args.since) or (args.until and published > args.until):
|
|
295
|
+
reason = "outside_requested_publication_period"
|
|
296
|
+
if reason:
|
|
297
|
+
report["excluded"].append({"url": item["url"], "reason": reason})
|
|
298
|
+
elif len(report["candidates"]) < args.limit:
|
|
299
|
+
report["candidates"].append(item)
|
|
300
|
+
else:
|
|
301
|
+
report["excluded"].append({"url": item["url"], "reason": "final_result_cap"})
|
|
302
|
+
for item in report["candidates"][:args.inspect]:
|
|
303
|
+
if report["budget"]["calls_started"] >= args.max_calls:
|
|
304
|
+
item["metadata_inspection"] = {"status": "budget_exhausted"}
|
|
305
|
+
continue
|
|
306
|
+
# In reviewed 1.19.0, --check-only suppresses ensureBinaries provisioning.
|
|
307
|
+
result = runner.call(["info", item["url"], "--check-only", "--json"])
|
|
308
|
+
if result["state"] != "budget_exhausted":
|
|
309
|
+
report["budget"]["calls_started"] += 1
|
|
310
|
+
payload = parse_payload(result)
|
|
311
|
+
expected_id = item["content_id"]
|
|
312
|
+
valid = (result.get("exit_code") == 0 and isinstance(payload, dict)
|
|
313
|
+
and payload.get("id") == expected_id and isinstance(payload.get("title"), str))
|
|
314
|
+
inspection = {"status": "metadata_retrieved" if valid else "failed",
|
|
315
|
+
"observed_at": utcnow(), "error": None if valid else result.get("error") or result.get("stderr") or "unexpected info JSON or mismatched content ID",
|
|
316
|
+
"count_warning": "info view_count may be likes or a synthetic zero; never used as verified views"}
|
|
317
|
+
if valid:
|
|
318
|
+
inspection.update(title=clean(payload["title"]), uploader=clean(payload.get("uploader")),
|
|
319
|
+
duration_seconds=number(payload.get("duration"), positive=True))
|
|
320
|
+
item["metadata_inspection"] = inspection
|
|
321
|
+
report["metadata_runs"].append({"url": item["url"], **inspection})
|
|
322
|
+
states = [r["state"] for r in report["runs"]]
|
|
323
|
+
success = sum(s in {"ok", "empty", "protocol_partial"} for s in states)
|
|
324
|
+
report["status"] = ("failed" if not success else "partial" if success < len(states) or "protocol_partial" in states
|
|
325
|
+
or any(r["status"] != "metadata_retrieved" for r in report["metadata_runs"])
|
|
326
|
+
else "ok" if report["candidates"] else "empty")
|
|
327
|
+
if any(r["state"] == "ok" for r in report["runs"]) and not report["candidates"]:
|
|
328
|
+
report["warnings"].append("Candidates were returned but none survived validation/filters; not proof that no relevant posts exist")
|
|
329
|
+
report["warnings"].append("Fewer results than requested" if len(report["candidates"]) < args.limit else "Candidate set requires purpose-fit review")
|
|
330
|
+
return report
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def md_cell(value):
|
|
334
|
+
text = clean(str(value)) if value is not None else "미확인"
|
|
335
|
+
return html.escape(text or "미확인").replace("\\", "\\\\").replace("|", "\\|").replace("[", "\\[").replace("]", "\\]").replace("`", "\\`")
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def markdown(report):
|
|
339
|
+
out = ["# SNS 검색 후보", "", f"상태: {report['status']} · 관측 시각: {report['created_at']}",
|
|
340
|
+
"검색 후보·제공자 순서이며, 전체 SNS/인기 순위·영상 시청·사실 검증 결과가 아닙니다.",
|
|
341
|
+
f"플랫폼 선택: {report['request'].get('platform_selection', 'not_recorded')} · 게시일 조건: {md_cell(report['request']['since'])} ~ {md_cell(report['request']['until'])}", "",
|
|
342
|
+
"| 제목·링크 | 플랫폼·게시자 | 게시일 | 조회수 / 기타 지표 | 확인 수준 | 선정 근거 |", "|---|---|---|---|---|---|"]
|
|
343
|
+
for item in report["candidates"]:
|
|
344
|
+
metric = item["metrics"]
|
|
345
|
+
extra = f" / Reddit score·upvotes(구분 미확인): {metric['reddit_score_or_upvotes']}" if metric["reddit_score_or_upvotes"] is not None else ""
|
|
346
|
+
out.append(f"| [{md_cell(item['title'])}]({item['url']}) | {item['platform']} · {md_cell(item['uploader'])} | {md_cell(item['published_date'])} | {md_cell(metric['views'])}{extra} | {item['evidence_level']} | {md_cell(item['selection_reason'] or '검색 후보; 목적 적합성 미검증')} |")
|
|
347
|
+
out += ["", "## 검색 실행·한계"]
|
|
348
|
+
for run in report["runs"]:
|
|
349
|
+
out.append(f"- {md_cell(run['platform'])} / {md_cell(run['query'])}: {run['state']} ({run['candidate_rows']} rows); {md_cell(run.get('error'))}")
|
|
350
|
+
if report["metadata_runs"]:
|
|
351
|
+
out += ["", "## 선택 메타데이터 조회 (본문·영상 검사 아님)"]
|
|
352
|
+
out += [f"- {r['url']}: {r['status']} / {md_cell(r.get('error'))}" for r in report["metadata_runs"]]
|
|
353
|
+
out += ["- " + md_cell(x) for x in report["unapplied_filters"] + report["warnings"] + report["limits"]]
|
|
354
|
+
out += [f"- 제외·중복·상한 기록: {len(report['excluded'])}건. 세부 근거는 JSON의 excluded/observations 참조."]
|
|
355
|
+
out += [f" - {md_cell(reason)}: {count}" for reason, count in Counter(e['reason'] for e in report['excluded']).items()]
|
|
356
|
+
return "\n".join(out) + "\n"
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def parser():
|
|
360
|
+
p = argparse.ArgumentParser(description=__doc__)
|
|
361
|
+
p.add_argument("--query", action="append", required=True)
|
|
362
|
+
p.add_argument("--platform", action="append", choices=[*SITES, "all"])
|
|
363
|
+
p.add_argument("--mode", choices=["general", "reference", "demand"], default="general")
|
|
364
|
+
p.add_argument("--limit", type=int, default=10)
|
|
365
|
+
p.add_argument("--per-search", type=int, default=10)
|
|
366
|
+
p.add_argument("--max-calls", type=int, default=6)
|
|
367
|
+
p.add_argument("--inspect", type=int, default=0, help="optional info calls; default 0, never body/video verification")
|
|
368
|
+
p.add_argument("--timeout", type=float, default=30)
|
|
369
|
+
p.add_argument("--total-timeout", type=float, default=120)
|
|
370
|
+
p.add_argument("--since", type=lambda s: date.fromisoformat(s).isoformat())
|
|
371
|
+
p.add_argument("--until", type=lambda s: date.fromisoformat(s).isoformat())
|
|
372
|
+
p.add_argument("--language")
|
|
373
|
+
p.add_argument("--region")
|
|
374
|
+
p.add_argument("--exclude", action="append", default=[])
|
|
375
|
+
p.add_argument("--executable", default="flucto")
|
|
376
|
+
p.add_argument("--format", choices=["json", "md"], default="json")
|
|
377
|
+
p.add_argument("--output", type=Path)
|
|
378
|
+
p.add_argument("--plan", action="store_true", help="no subprocess/network; show the bounded plan")
|
|
379
|
+
return p
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def main(argv=None):
|
|
383
|
+
p = parser()
|
|
384
|
+
args = p.parse_args(argv)
|
|
385
|
+
if any(not q.strip() or len(q) > 500 or q.lstrip().startswith("-") or re.search(r"[\x00-\x1f\x7f]", q) for q in args.query):
|
|
386
|
+
p.error("queries must be nonempty, <=500 chars, no option prefix or control characters")
|
|
387
|
+
if any(not term.strip() or len(term) > 500 or re.search(r"[\x00-\x1f\x7f]", term) for term in args.exclude):
|
|
388
|
+
p.error("exclude terms must be nonempty, <=500 chars and free of control characters")
|
|
389
|
+
args.exclude = list(dict.fromkeys(term.strip() for term in args.exclude))
|
|
390
|
+
args.query = list(dict.fromkeys(q.strip() for q in args.query))
|
|
391
|
+
args.platform_defaulted = args.platform is None
|
|
392
|
+
platforms = args.platform or ["youtube"]
|
|
393
|
+
args.platform = list(SITES) if "all" in platforms else list(dict.fromkeys(platforms))
|
|
394
|
+
if not (1 <= args.limit <= 50 and 1 <= args.per_search <= 50 and 1 <= args.max_calls <= 24
|
|
395
|
+
and 0 <= args.inspect <= 10 and math.isfinite(args.timeout) and 0 < args.timeout <= 60
|
|
396
|
+
and math.isfinite(args.total_timeout) and 0 < args.total_timeout <= 300):
|
|
397
|
+
p.error("invalid result/call/time limits")
|
|
398
|
+
if len(args.query) * len(args.platform) + args.inspect > args.max_calls:
|
|
399
|
+
p.error("query/platform fanout plus reserved info calls exceeds --max-calls; narrow the plan")
|
|
400
|
+
if args.since and args.until and args.since > args.until:
|
|
401
|
+
p.error("--since must not be after --until")
|
|
402
|
+
if args.output and (args.output.exists() or args.output.is_symlink() or not args.output.parent.is_dir()):
|
|
403
|
+
p.error("--output must be a new file in an existing directory; no overwrite or implicit directory creation")
|
|
404
|
+
if args.plan:
|
|
405
|
+
result = {"status": "planned_not_executed", "queries": args.query, "platforms": args.platform,
|
|
406
|
+
"network_cli_calls_upper_bound": len(args.query)*len(args.platform)+args.inspect,
|
|
407
|
+
"version_probe_calls": 1, "unverified_scope_filters": ["language", "region"],
|
|
408
|
+
"date_filter": "post-filter only; missing publication date excluded when period is requested"}
|
|
409
|
+
output = json.dumps(result, ensure_ascii=False, indent=2) + "\n"
|
|
410
|
+
code = 0
|
|
411
|
+
else:
|
|
412
|
+
exe = shutil.which(args.executable)
|
|
413
|
+
if not exe:
|
|
414
|
+
p.error("Flucto is unavailable; installation is separate authorization")
|
|
415
|
+
try:
|
|
416
|
+
report = search_report(args, Runner(exe, time.monotonic()+args.total_timeout, args.timeout))
|
|
417
|
+
except OSError as exc:
|
|
418
|
+
print(json.dumps({"status": "blocked", "error": clean(str(exc))}), file=__import__('sys').stderr)
|
|
419
|
+
return 2
|
|
420
|
+
output = markdown(report) if args.format == "md" else json.dumps(report, ensure_ascii=False, indent=2, allow_nan=False) + "\n"
|
|
421
|
+
code = {"blocked": 2, "failed": 2, "partial": 3}.get(report["status"], 0)
|
|
422
|
+
if args.output:
|
|
423
|
+
with args.output.open("x", encoding="utf-8", newline="\n") as handle:
|
|
424
|
+
handle.write(output)
|
|
425
|
+
else:
|
|
426
|
+
print(output, end="")
|
|
427
|
+
return code
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
if __name__ == "__main__":
|
|
431
|
+
raise SystemExit(main())
|