Take the weekly special price page of Turing community as an example:https://www.ituring.com.cn/tag/36527
Grab content
This page will update three half price e-books every Monday
After copying and pasting, you can see that the XPath of the three books are:
//*[@id="tag-book"]/div/ul/li[1]/div[2]/h4/a
//*[@id="tag-book"]/div/ul/li[2]/div[2]/h4/a
//*[@id="tag-book"]/div/ul/li[3]/div[2]/h4/a
Only the middleli[]
The content is different
So the options section and the XPath part can be usedli[*]
Match all cases. You can write as follows:
{
"expected_update_period_in_days": "2",
"url": "https://www.ituring.com.cn/tag/36527",
"type": "html",
"mode": "on_change",
"extract": {
"url": {
"xpath": "//*[@id=\"tag-book\"]/div/ul/li[*]/div[2]/h4/a",
"value": "@href"
},
"title": {
"xpath": "//*[@id=\"tag-book\"]/div/ul/li[*]/div[2]/h4/a",
"value": "@title"
}
}
}
Push content
Use slack agent to push
Options section:
{
"webhook_url": "https://hooks.slack.com/services/xxxx/xxxxxxxx",
"channel": "#book",
"username": "Huginn",
"message": "{{title}} https://www.ituring.com.cn{{url}}",
"icon": ""
}