feapder
v1.0.0Build, modify, and debug feapder 1.9.2 spiders and projects with the framework's native patterns. Use when working on feapder codebases or when requests mention feapder, AirSpider, Spider, TaskSpider, BatchSpider, Request/Response parsing, Item or UpdateItem, pipeline integration, render settings, p...
Installation
Feapder
Overview
Implement feapder 1.9.2 code in the style expected by the framework's own docs, templates, and tests. Choose the right spider base class first, then follow the matching startup, request, parse, persistence, and debugging patterns.
Workflow Decision Tree
- Classify the request before writing code:
- Use
AirSpiderfor small, local, non-distributed jobs. - Use
Spiderfor Redis-backed distributed crawling, resumable queues, and automatic item persistence. - Use
TaskSpiderwhen seeds come from MySQL or Redis task tables and the framework should manage seed loading. - Use
BatchSpiderfor periodic batches with batch records and explicit task-state transitions. - Read only the reference file that matches the task:
- Spider selection, CLI scaffolding, and project layout: references/spider-types-and-scaffolding.md
- Code patterns for request flow, items, task updates, and render usage: references/code-patterns.md
- Settings, pipelines, shell debugging, and upstream source anchors: references/settings-debugging-and-sources.md
- Reuse feapder conventions instead of inventing abstractions:
- Import
feapderdirectly and subclass the correct base spider. - Emit work with
yield feapder.Request(...). - Keep parsing in
parseor explicit callback methods passed throughcallback=.... - Prefer
__custom_setting__for spider-local overrides andsetting.pyfor project-wide config. - Default to
from feapder.utils.log import logandlog.info(...)for runtime logs instead ofprint(...)unless the user explicitly asks to mirror upstream demo output. - Default to concise Chinese log messages and Chinese code comments when comments are needed.
- If the user asks to create new feapder code, prefer the framework's generated structure and naming conventions over bespoke layouts.
- If the user asks for a simple crawler demo and does not mention persistence,
Item,UpdateItem, pipeline wiring, Redis, MySQL, task tables, batch scheduling, distributed workers, or multi-file output, default to the single-fileAirSpiderstyle shown in references/vendor/feapder-1.9.2/tests/air-spider/test_air_spider.py: one file, one spider class, minimal startup block, and only the code required to demonstrate the requested behavior.
Working Rules
- Keep output aligned with feapder 1.9.2, not newer community variants.
- Prefer minimal, working spider code over framework-agnostic architecture.
- When the request is underspecified, do not scaffold a full feapder project by default. Write the smallest single-file
AirSpiderdemo only for pure crawling or parsing requests. If the request mentionsItem,UpdateItem, 入库,ITEM_PIPELINES, Redis, MySQL, task tables, or batch/task state, choose the corresponding spider and project shape instead. - When modifying an existing feapder project, preserve its current spider type,
main.pydispatch style, item modules, andsetting.pyshape unless the user asks for a migration. - When persistence is needed, decide explicitly between:
- Manual DB calls with
MysqlDBorRedisDB - Automatic batch persistence via
ItemorUpdateItem - Custom
ITEM_PIPELINES - When render is required, set
render=Trueon the request and then align downloader configuration with the project'ssetting.pyor__custom_setting__. - When handling
BatchSpiderorTaskSpider, treat master and worker entrypoints separately. Do not collapse them into a single ambiguous startup path. - When writing new spider code, default to
log.info(...),log.error(...), and similar logger methods for runtime output. Avoidprint(...)unless the user explicitly asks for raw console prints or exact upstream reproduction. - Write log messages in Chinese by default, for example
log.info(f"第{request.page}页原始结果 | {response.json}"). - Write comments in Chinese by default and only keep comments that clarify non-obvious logic.
Chinese Trigger Hints
Treat these Chinese requests as strong signals to use this skill:
用 feapder 写一个爬虫帮我改这个 AirSpider把这个项目迁移到 Spider 或 BatchSpider写 feapder 的 item / pipeline / setting.py用 feapder shell 调试分析 feapder 1.9.2 示例代码
Implementation Checklist
Before finishing a feapder task, verify the code against this checklist:
- The spider inherits the correct feapder base class.
- If the task is a pure crawling or parsing demo and does not require persistence or task orchestration, the new spider defaults to the single-file
AirSpiderpattern anchored byreferences/vendor/feapder-1.9.2/tests/air-spider/test_air_spider.py. - Startup code passes the required constructor args such as
redis_key,task_table,task_keys, or batch metadata when needed. - Request callbacks, carried parameters, and middleware hooks use feapder's expected method signatures.
- Distributed spiders update task state where required instead of relying on implicit completion.
- Item, pipeline, and setting references match the project's existing module layout.
- Debugging guidance uses feapder-native tools such as
feapder shell,to_DebugSpider, orto_DebugBatchSpiderwhen appropriate. - New example code uses
logfor runtime logs, with Chinese log text and Chinese comments unless the user requested a different style.
Source Anchors
Use the vendored feapder 1.9.2 snapshot under references/vendor/ as the source of truth. This keeps the skill portable when copied to another machine:
- Core overview: references/vendor/feapder-1.9.2/README.md
- Usage docs: references/vendor/feapder-1.9.2/docs/usage/AirSpider.md, references/vendor/feapder-1.9.2/docs/usage/Spider.md, references/vendor/feapder-1.9.2/docs/usage/TaskSpider.md, references/vendor/feapder-1.9.2/docs/usage/BatchSpider.md
- CLI and project generation: references/vendor/feapder-1.9.2/docs/command/cmdline.md
- Minimal runnable examples: references/vendor/feapder-1.9.2/tests/air-spider/test_air_spider.py, references/vendor/feapder-1.9.2/tests/spider/spiders/test_spider.py, references/vendor/feapder-1.9.2/tests/batch-spider/spiders/test_spider.py, references/vendor/feapder-1.9.2/tests/test-pipeline/pipeline.py