Site Rule Wiki
update date: 2026-02-28
If you don’t know how to write rules, you can search for site rules shared by other users via Google, Yahoo, Baidu or other methods.
If you want to learn how to write site rules, please refer to the following post.
SiteRule has three main components: Site, Rule, and Selector. The relationship between the three is contained layer by layer, that is, Site contains multiple Rule, and Rule contains a variety of Selector.
The first thing we need to understand is the Selector, through which we can locate and find the data we need. The Rule is a collection that contains various Selectors. Different Selectors can get different data. The final combination of each Rule is a Site!
Well, now let’s start learning the grammar rules of SiteRule.
Selector
The Selector is the most important part of the entire SiteRule, because the behavior of the Selector definition is to tell Yealico how to get the specified data. The prerequisite for being able to use Selector proficiently is that you should understand HTML, CSS, JSONPath, and Regular Expression.
Selector contains 5 parameters: selector, function, param, regex, replacement.
selector
CSS3 grammar-adaptive selectors that can select specific HTML tags (hereinafter “elements”) .
JSONPath is supported since version 5.4.1. When JSONPath is prefixed with ‘$root’ (since ver.6.7.1), it means to start searching for elements from the beginning of the JSON.
Special syntax – this, represents the currently selected element (hereinafter referred to as “current element”).
function
The method that will be executed on the current element. Function supports the following values:
- html: Get all the HTML strings inside the current element;
- text: Get all the pure strings (remove all HTML tags) inside the current elements;
- attr: Will get the current element’s attribute value. Which attribute value is specifically obtained must be determined by setting the param parameter;
- Blank charactor or nil: Get all HTML strings that contain the current element itself.
Support multiple functions, separated by commas.
More functions supported after ver.6.7.0.
- decodeBase64: can decode Base64-encoded strings. (6.7.0)
- removingPercentEncoding: can remove percent-encoded strings. (6.7.0)
- addingPercentEncoding(allowedCharacters): can percent-encode strings, where the parameter allowedCharacters is optional and specifies characters that do not need to be encoded. (6.7.0)
- replace(“String1“, with: “String2“): You can replace String1 in the target text with String2. (6.8.2)
- decompressFromBase64: It can decode strings that are Base64-encoded and compressed using LZString. (6.14.5)
param
When the selector’s function is set to “attr”, param specifies the name of the property that will get the property value.
Support multiple attributes, separated by commas.
regex
Is a regular expression used on the string obtained by the above selector, containing at least one Group. The matched values are represented using the placeholders $1, $2, $3… Placeholders can be used in replacement.
replacement
The prerequisite for using replacement is that the regex parameter has been set. Using replacement alone has no effect.
When replacement is empty, the default is a $1 placeholder, which is the first Group value matched using regex.
If nothing matches and you want to use the original string, you can use the |{source:} placeholder.
By using the placeholders that the regex matches, you can combine the final string results you want. Of course, it can also be a mathematical expression, which is generally used to obtain a Rating.
Selector supports “+” to connect multiple JSONPaths. They correspond to placeholders such as $1, $2, etc. This function is supported in versions 6.5 and later.
URL Placeholders (7.1.1 or above)
URL placeholders allow extracting parts of the current page URL for building dynamic link patterns.
All placeholders are case-insensitive.
{urlPath:n}
- Extract a path segment
- 1 = first path segment
- 0 = host (domain)
- Negative index supported (e.g.
-1= last segment) *returns all path segments joined by “/”- Out of range returns empty string
Example URL:
https://example.com/v1/api/list/detail?id=100&lang=en
{urlPath:0} → example.com
{urlPath:1} → v1
{urlPath:-1} → detail
{urlPath:*} → v1/api/list/detail
{urlQuery:keyname}
- Extract a query parameter value
- Use
|defaultto provide fallback value *returns all query pairs- If not found, returns empty string (or default)
{urlQuery:id} → 100
{urlQuery:page|1} → 1
{urlQuery:*} → id=100&lang=en
Other Supported Placeholders
- {urlScheme} → https
- {urlHost} → example.com
- {urlPort} → (empty if none)
Rule
Rule is a collection of various Selectors, different Selector can get different data. Rule is further subdivided into three types of specific pages: SeriesRule, ListRule, DetailRule, and GalleryRule.
SeriesRule, ListRule
SeriesRule is mainly applied to the top-level page of ListRule. For example, some websites do not only have a List page, but also a Series page. Click Series and you can enter the corresponding List.
Of course, if you need to write each Tag link as a Page, it is a very good choice to use SeriesRule directly to get all the contents of the Tag page.
This way you can unify all the tags into one page, and click on Tag to get the corresponding List conveniently.
ListRule is mainly applied to list pages such as a general list page, a tag link page, and a search page.
ListRule contains the following Selectors:
text (6.7.0)
If this Selector is set, the text obtained by this Selector will be used as the final data to be parsed.
item
Select each item in the list and the result obtained should be a collection containing multiple items of the same type.
For example, the website’s latest article page is generally a list page, and this page will list the latest articles in order of date. The collection we get through the item Selector should be a collection of all the latest articles on this page.
After getting the items, how can we get the detailed data contained in each item? For example, the article’s title, author, update time, rating, etc. At this time we need to use the following Selector to get the corresponding data.
All of the following Selector’s selections are limited to each item retrieved above.
idCode
The unique identifier of the item. idCode replaces the {idCode:} placeholder in the URL pattern.
title
The title of the item.
cover
The cover image url of the item.
coverWidth
Width of the cover image of the item.
coverHeight
Height of the cover image of the item.
largeImage
The large image url of the item.
Video
The video url of the item.
category
The category of the item.
author
The author of the item.
uploader
The uploader of the item.
published
The time when the item was released.
datetime
The time of the item, generally refers to the update time.
rating
The rating of the item.
totalImages
The total number of images.
When this parameter is set and the pictureRule’s url in DetailRule container the paging placeholder, {page:}, Yealico will automatically get the url of all the big images according to the paging rule.
DetailRule
DetailRule is mainly used for detailed pages. Generally, it refers to the linked page after clicking item in the ListRule. The definitions of Selector: title, cover, category, author, uploader, published, datetime, and rating are the same as described in ListRule.
In addition, DetailRule also contains several mini-rules, including: tagRule, pictureRule, chapterRule, and commentRule.
totalImages
The total number of images in the detail page.
When this parameter is set and the pictureRule’s url container the paging placeholder, {page:}, Yealico will automatically get the url of all the big images according to the paging rule.
photoAlbumLink (Second Level Page)
Some sites’ albums, chapters or videos are not on the detailed page, you need to click on the link of the second level page to get the details of the album, the chapters or the videos.
When you set the photoAlbumLink (Second Level Page), pictureRule will act on the link page corresponding to photoAlbumLink (Second Level Page). ChapterRule and VideoRule will be the same.
tagRule
Get all tag data in the detail page.
tagRule contains the following Selector:
item
Get a collection containing all the tags.
All of the following Selector selections are limited to each item retrieved.
name
The name of the tag.
url
The page link of the tag.
pictureRule
Get all image data in the detail page.
pictureRule contains the following Selectors:
item
Get a collection containing all the pictures.
All of the following Selector selections are limited to each item retrieved.
thumbnail
Thumbnail of the picture.
url
The big picture url of the picture. When a link selector is defined, this url selector will be executed on the page pointed to by the link.
If the URL string obtained in VideoRule contains the prefix ‘web:’, then use WebView to load this URL. (6.7.0)
link
Get the page link for getting the big picture url.
videoRule
Same as pictureRule.
chaperterRule
Get all chapter data in the detail page.
The chapterRule contains the following Selectors:
item
Gets a collection containing all chapters.
All of the following Selector selections are limited to each item retrieved.
idCode
The unique identifier of the chapter. The section’s idCode must be distinguished from the ListRule’s idCode. The chapter’s idCode replaces the {cidCode:} placeholder in the URL pattern.
This ID Code is required for bookmark records.
title
The title of the chapter.
datetime
The date time of the chapter.
url
The page link which the chapter point to.
commentRule
Get all comment data in the detail page.
The commentRule contains the following Selectors:
item
Get a collection containing all comments.
All of the following Selector selections are limited to each item retrieved.
avatar
The avatar image of the user.
username
The user name of the comment.
datetime
The date time of the comment.
content
The content of the comment.
GalleryRule
GalleryRule is mainly used for picture browsing pages.
The GalleryRule contains the following Selectors:
secondLevelPageUrl
Some sites’ images or videos are not on the gallery page, you need to click on the link of the second level page to get the details of the images or the videos.
When you set the secondLevelPageUrl (Second Level Page), pictureRule will act on the link page corresponding to secondLevelPageUrl (Second Level Page). VideoRule will be the same.
totalPages
The total number of pages on the picture browsing page.
item
Get a collection of all picture data for the current page.
image
The url of the item.
videoRule
Same as pictureRule.
Site
Site, as the outermost layer of the entire site rules, contains the basic settings of the site, page settings, default URL patterns for various pages, and page rules.
Site contains the following parameters:
name
The name of the site.
domain
The string corresponding to the placeholder {domain:}. Generally refers to the domain name of the website. Supported after version 6.5.
displayMode
The default display mode of the list page, support: text, table, collection, waterfall, tag. Waterfall needs to get the width and height of the picture in the ListRule, otherwise it automatically switches back to the collection display mode.
loginUrl
Login page link address.
indexUrl, detailUrl, galleryUrl, searchUrl
These are the link URL pattern for the list page, detail page, picture browsing page, and search page. The link URL pattern for these pages can contain the following types of placeholders:
{page: start page number: increment page number}
Paging placeholders. For example, {page:1:1} indicates that the paging start page number is 1, and each paging page is incremented by 1. If every increment page number is 1, it can be shortened to {page:1}.
If the first page does not require paging information, use the following placeholders:
{pageFormat:{page: start page number: increment page number}}
{idCode:}
Represents the unique identifier of the item in the ListRule. Mainly used in detailUrl.
{cidCode:}
The unique identifier that represents the chapter. Mainly used in galleryUrl.
{keyword:}
Keywords placeholders for search pages. When the user searches, the entered keyword will first replace this placeholder and then initiate a search request to the server.
{json:jsonFormatString…} 6.11
The placeholder added at the end of the URL indicates that this URL requires sending a JSON body. The content of the JSON body corresponds to the string following “jsonString…”. When this placeholder is present, the request method is automatically switched to POST.
seriesRule
The default series page rule. It’s a ListRule.
indexRule
The default list page rule. It’s a ListRule.
detailRule
The default detail page rule. It’s a DetailRule.
galleryRule
The default picture browsing page rule. It’s a GalleryRule.
pages
Sites can set up multiple pages. Each page can also be customized for its own displayMode, flags, indexUrl, detailUrl, galleryUrl, listRule, detailRule and galleryRule.
When you need to set the associated ListRule for the current page, you need to set relListRuleIndex to the index of the corresponding ListRule.
Similarly, you can set the detailRule and the galleryRule.
flags
Use flags to set some more details on the site.
Supported flags are:
loginRequired
Note that the site must log in before normal data can be obtained.loginRequired
consentRequired (ver.6.13)
Users are required to complete the pre-entry consent prompt before browsing the website.
repeatedThumbnail
The acquired thumbnail is a large image, which is then displaced by background-position.
ignoreDetail
When using the app, go directly to the picture browsing page from the list page and ignore the detail page. Generally used for image board sites such as mbooru.
jsNeededIndex, jsNeededDetail, jsNeededGallery, jsNeededSearch, jsNeededTagLink, jsNeededPhotoAlbum, jsNeededSecondLevelPageGallery,jsNeededAll
Marking the list page, detail page, and picture browsing page respectively requires the web browser to load the page in order to obtain the data normally because of the need to execute javascript.
postSearch, postIndex, postDetail, postGallery, postPhotoAlbum, postAll, postTagLink
Note that a search need to be sent via POST. The parameters are put into the searchUrl as well as the GET method.
scrollIndex, scrollDetail, scrollGallery (ver.6.14.1)
If a site is marked to be loaded using a WebView (that is, any flag with the jsNeeded prefix is set), these flags are then used to determine whether the corresponding Index, Detail, and Gallery pages should automatically scroll to the bottom after the page has finished loading.
big5CharsetIndex, big5CharsetDetail, big5CharsetGallery, big5CharsetSearch, gbkCharsetIndex, gbkCharsetDetail, gbkCharsetGallery, gbkCharsetSearch
Specify the charset of the HTML for the page.
gbkUrlEncodingAll
Use GBK encoding to replace the Chinese characters in the url with percent-encoded characters.
userAgentMobile
Simulate mobile device access to website.
seriesRules, listRules, detailRules, galleryRules
Provide additional seriesRule, listRule, detailRule and galleryRule to facilitate different Pages.
HTTP Headers
Custom HTTP Headers are supported starting from version 6.3.
Headers only support JSON format. For example: {“key1”: “value2”, “key2”: “value2″…}
Priority: Rule > Page > Site.
Cookie
Browser Cookie
Browser Cookie is obtained while browsing websites using the built-in browser. It is commonly used to store data that requires browser interaction, such as selected website language or user login information.
Custom Cookie
Custom Cookie serves as a supplement to the Browser Cookie. Users can manually set specific cookie values, and if any of these values conflict with those in the Browser Cookie, the Custom Cookie takes priority.
