hoothin / UserScripts

Greasemonkey scripts ( Pagetual / Picviewer CE+ / DownloadAllContent ) 油猴腳本集 ユーザースクリプト集
https://greasyfork.org/users/8227-hoothin
3.09k stars 511 forks source link

Help on adding next page rule for alibaba.com #107

Closed reddysat07 closed 2 years ago

reddysat07 commented 2 years ago

Could you help with the example of how to add rule for Alibaba, Example alibaba search results page: https://www.alibaba.com/trade/search?IndexArea=product_en&SearchText=torch&page=2&f0=y

When the page data is viewed, the link to 'next' page Arrow ( > ) element is: //*[@id="root"]/div/div[4]/div/div[1]/a[9]

Full Xpath: /html/body/div[4]/div[2]/div/div[4]/div/div[1]/a[9]

Could you help by providing Pagetual rule and also Autopagerize rule for this website?

Thank you in advance

hoothin commented 2 years ago
  {
    "name":"Alibaba",
    "url":"^https://www\\.alibaba\\.com/trade/search",
    "pageElement":".organic-list>*",
    "nextLink":".seb-pagination__pages>span+a",
    "action":1,
    "pageAction":"eles.forEach(ele=>{let img=ele.querySelector('div[data-image]>img');if(!img)return;img.src=img.parentNode.dataset.image})",
    "wait":"return doc.querySelector('.seb-pagination__pages') && !doc.querySelector('.organic-list>p>i.ui2-icon-loading')"
  }

Autopagerize will not support until it add page action for javascript

reddysat07 commented 2 years ago

Thank you, it worked

hoothin commented 2 years ago

Flipkart.com will work with automatic rule so don't need to create new one.