Skip to content

Rule Overview

The rule system is responsible for converting thumbnails, lazy-loaded images, or inner page images into "downloadable original images". Rules are composed of multiple fields and are divided into two modes:

  • JSON Mode: Pure data rules, safe and easy to maintain.
  • JS Mode: Allows function logic, suitable for complex sites.

Matching Process

  1. Determine if the site matches based on url (no url implies all sites).
  2. Get the original image based on src, r/s, or getImage.
  3. If the target is not an image element, use ext or getExtSrc.
  4. Use xhr when inner page fetching is needed.
  5. Return the result to the float bar and gallery.

Matching Priority

When multiple rules hit the same site, they are executed in order. Suggestions:

  • Write specific site rules first (url restricted).
  • Then write global general rules (src or r/s).

Return Value Rules

  • string: Single image URL.
  • array: Multiple image URLs.
  • object: { url: [], cap: '' } format for returning images and descriptions simultaneously (common in xhr).

Common Fields

FieldFunction
nameRule Name
urlSite Match
srcImage Match
r / sReplacement Rule
lazyAttrLazy Load Attribute
extNeighbor Element Image
getImageJS Logic Image Retrieval
getExtSrcNon-Image Element Retrieval
xhrInner Page Fetch
clickToOpenClick to Open
excludeExclude Rule

Performance Tips

  • Prefer r/s over xhr whenever possible.
  • Use xhr only when necessary and limit url and selector scope as much as possible.
  • The more precise the rule, the fewer false positives, and the more stable the overall performance.