高级自定义
若您发现永页机有用且有余力,请杯咖啡将令我不胜感激。如果没有,也不用担心 - 开源万岁!💞 | ||||
---|---|---|---|---|
PayPal | Ko-fi | 爱发电 | ||
加入💬Discord群 | ||||
通过📧E-mail联系我 | ||||
Made with ❤️ by Hoothin | ||||
[
{
"name":"yande",
"url":"^https://yande-demo\\.re/",
"pageElement":"ul#post-list-posts>li",
"nextLink":"a.next_page",
"css":".javascript-hide {display: inline-block !important;}"
},
{
"name": "so.3dm",
"url": "^https://so\\.3dmgame-demo\\.com",
"pageElement": "div.content > div.search_wrap > div.search_lis",
"action": 1
},
{
"name":"xxgame",
"url":"^http://www\\.xxgame-demo\\.net/chinese",
"pageElement":"div.layui-row>div.layui-col-md4:not(div:nth-child(5),div:nth-child(6),div:nth-child(7))",
"nextLinkByUrl":[
"(http://www\\.xxgame-demo\\.net/chinese/?)(?:\\?page=|$)(\\d*)",
"$1?page={$2+1}"
]
}
]
name
Name of the target site
"name": "Site name"
author
Author of this rule
"author": "Hoothin"
example
Example url of this rule
"example": "https://abc.com"
url
RegExp for the url of target site
"url": "^https://abc\\.com/\\d+"
pinUrl
Sometimes the next link or page element will be inexistence, set this to true so you can pin the rule just with url instead of finding elements by intelligent rules
"pinUrl": true
enable
0 means stop action when all matched
"enable": 0
include
Selector or xpath of the element which must include
"include": "div.content"
exclude
Selector or xpath of the element which must not include
"exclude": "div.content"
wait
The time to wait for page ready when you are sure the url match the site, you can also use a javaScript code which return a boolean to check if the page is ready instead
"wait": 500
"wait": "let img=doc.querySelector('ul.list img');return img!=null"
waitElement
The array["exist", "not exist"] contains "selector or xpath of element must exist (for some lazyload element)" & "selector or xpath of element must not exist (for some loading placeholder which need scroll into view to load)"
"waitElement": [
".summary",
"#popular.fade:not(.in)"
]
action
0 means load url and insert with static html, 1 means load by iframe so that dynamic javaScript code on page may effect, 2 means force insert iframe to bottom
"action": 1
nextLink
Selector or xpath of next page link, disable when set to 0, you can let it to be a array to contains multiple next links.
"nextLink": ".page-next>a"
"nextLink": [
".page1-next>a",
".page2-next>a",
".page3-next>a"
]
nextLinkByUrl
If there is no next element, you can use this to generate a href from current url, [0] means RegExp string, [1] means replace string, [2] means selector or xpath of the element which must include, [3] means selector or xpath of the element which must not include, you can use {} to eval simple code
"nextLinkByUrl": [
"(&page=(\\d+))?$",
"&page={$2+1}"
]
"nextLinkByUrl": [
"(&page=(\\d+))?$",
"&page={$2+1}",
".disable>button"
]
nextLinkByJs (doc)
Use this to eval javaScript code and return target url of next page with doc (document of every page loaded)
"nextLinkByJs": "let n=doc.querySelector('a.curr+a');if(n)return n.href.replace(/^javascript:.*\\((\\d+)'\\);/,'$1_.html');"
stopSign
Stop to load next page when matching this sign
"stopSign": ["#pagenum", ".disable",
[
"#pagenum",
"(\\d+)"
],
[
"#pagenum",
"\\/(\\d+)"
]
]
pageElement
Selector or xpath of main content which need to insert, you can let it to be a array to contains multiple page elements.
"pageElement": ".Context>.Article"
pageElementByJs (over)
Use this to eval javaScript code and create the elements whatever you want to insert, a over(eles) is needed to callback with elements array for insert
"pageElementByJs": "let src=match[1]+match[3];img.onload=()=>{over([img])};img.onerror=e=>{over()};img.src=src;"
replaceElement
Selector or xpath of element which you want to replace with new one, can be a array
"replaceElement": "#page"
"replaceElement": ["#page1", "#page2"]
lazyImgSrc
The attr of image which target to real src, can be set by ["lazysrc", "removeProp1,removeProp2"] to remove props of image
"lazyImgSrc": "data-cfsrc"
"lazyImgSrc": ["data-lazy-src", "removeProp1,removeProp2"]
css
Add css so you can show some hidden element, start with "inIframe:" then this css will effect only in next iframe page
"css": ".card-lazy{display:none}"
insert
Which position you want to insert, you can let it to be a array to contains multiple positions.
"insert": "ul#feed-main"
insertPos
1 means insert before, 2 means just append to the bottom of target
"insertPos": 2
iframeInit (win, iframe)
The javaScript code to run as fast as it can before any code in iframe is running.
"iframeInit": "win.self=win.top;"
init (doc, win, iframe, click, enter, input)
The javaScript code to run only once with current main page or every iframe with doc:(document of main page or iframe)
"init": "if(doc)doc.querySelector('[data-title=sh]').click();"
pagePre (response)
The javaScript code to run after get response from URL of next link, you can modify the response content and return it
"pagePre": "return decodeURI(response).replace(/[\\\\]/g,'')"
pageInit (doc, eles)
The javaScript code to run with every page inserted with doc:(document of every page loaded) and eles:(elements found with rule), run before inserted, you can trigger event like onView()
"pageInit": "let ops=doc.querySelectorAll('op');[].forEach.call(ops,op=>{img.src=op.value;imgCon.appendChild(img)})"
pageAction (doc, eles)
The javaScript code to run with every page inserted with doc:(document of every page loaded) and eles:(elements found with rule), run after inserted, you can add functions like click()
"pageAction": "let j=document.querySelector('.lazy');eles.forEach(i=>{i.src=i.dataset.srcset;})"
filter
Filter the elements inserted from next page.
"filter": {
"count": 20,
"words": "spams\\d",
"link": "^https://spams\\.xxx",
"selector": "div#spam"
}
loadMore
Selector of "load more" button
"loadMore": ".loadMore"
sleep
Sleep time (ms) when load next page if site is limited by time interval
"sleep": 1000
rate
The multi-windowHeight which you can set to 2 or 3 while some sites load next page slowly
"rate": 3
autoLoadNum
The amount of pages for auto turning after page opening
"autoLoadNum": 5
listenHashChange
Set this to true so pagetual will restart when hash changed
"listenHashChange": true
refreshByClick
If the site reload content without changing url when click a submit button. Set this with the selector of the target button, pagetual will reset after click it.
"refreshByClick": "#sreach"
pageNum
Point the page number with $p in current url, you can use{} to eval result string from page number, like {$p*25+1}
"pageNum": "&start={15*($p-1)}"
pageBar (pageBar)
The javaScript code to change pageBar, 0 means hide
"pageBar": "pageBar.classList.add('j_thread_list');"
pageBarText
Set to 1 so the document title of next page will be shown on pagebar
"pageBarText": 1
autoClick
The css selector or xpath of element which you want to click automatically
"autoClick": "#btn-sky"
history
Set to 0 then history writing will be disable. Set to 1 then history writing will be enable. Set to 2 then history writing will action immediately after splicing. No matter what value is the general option.
"history": 1
lockScroll
Set to true if you don't want the page to auto scroll when navigate to next page
"lockScroll": true
wheel
Set to true so the next page action will only effect when the mouse wheel roll
"wheel": true
fitWidth
Set to false if you find the pageElement get the wrong small width
"fitWidth": false
delay
The javaScript code to delay next action until return true, use this prop to get complete page elements with lazy load.
"delay": "return document.querySelector('#feed_pagenation>li.cur').innerText>=curpage"
manualMode
Set to true to enable manual mode, then paging will stop, right arrow (or 'pagetual.next' event) will be bound to click next link.
"manualMode": true
openInNewTab
Set to true to make all links to open in new tabs, false to make them open in self.
"openInNewTab": true
pageElementCss
The style css which you want to set for every page element.
"pageElementCss": "color: red"
initRun
Run immediately upon initialization.
"initRun": true
sideController
Show or hide toolbar of sideController.
"sideController": true
listenUrlChange
Refresh script after url changed.
"listenUrlChange": false
clickMode
Stop turning page and click nextlink after scrolled to bottom.
"clickMode": true
preloadImages(doc)
Analyze the page and return an array of image's urls that need to be preloaded.
"preloadImages": "return ['1.jpg']"
child script
If the site has some limit for code eval. You can make a child script with function under object window
. You should name them start with pagetual
use camelCase. Like window.pagetualWait
, window.pagetualNextLinkByJs
, window.pagetualPageInit
, window.pagetualPageAction
, window.pagetualInit
, window.pagetualPageBarText
.