Created
August 1, 2019 08:48
-
-
Save dequn/674b0401c1f31f7919b112ad64640552 to your computer and use it in GitHub Desktop.
Huginn 微信公众号订阅 scenario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"schema_version": 1, | |
"name": "微信公众号订阅", | |
"description": "2019.08.01 更新,最新可用", | |
"source_url": "http://104.224.190.22:3000/scenarios/8/export", | |
"guid": "c0be876a712baf52fa4270d6b1744432", | |
"tag_fg_color": "#ffffff", | |
"tag_bg_color": "#00b050", | |
"icon": "eye", | |
"exported_at": "2019-08-01T08:46:10Z", | |
"agents": [ | |
{ | |
"type": "Agents::WebsiteAgent", | |
"name": "微信公众号 #3 Fetch 跳转URL", | |
"disabled": false, | |
"guid": "07771b5a19dc50901cdece327f56a0b6", | |
"options": { | |
"expected_update_period_in_days": "2", | |
"url_from_event": "https://weixin.sogou.com{{url}}", | |
"type": "text", | |
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36", | |
"headers": { | |
"Referer": "{{refer}}", | |
"Cookie": "{{cookie}}" | |
}, | |
"mode": "on_change", | |
"extract": { | |
"content": { | |
"index": "0", | |
"regexp": "\\A(?m:.)*\\z" | |
} | |
} | |
}, | |
"schedule": "every_12h", | |
"keep_events_for": 0, | |
"propagate_immediately": false | |
}, | |
{ | |
"type": "Agents::JavaScriptAgent", | |
"name": "微信公众号 #4 解析跳转URL", | |
"disabled": false, | |
"guid": "12a0dbce60dde12672ca32132bfaedce", | |
"options": { | |
"language": "JavaScript", | |
"code": "Agent.receive = function() {\r\n var events = this.incomingEvents();\r\n for(var i = 0; i < events.length; i++) {\r\n var s = events[i].payload['content'];\r\n var reg = /\\+\\= '(.*)';/g;\r\n var url = '';\r\n while (temp = reg.exec(s)) {\r\n url += temp[1];\r\n }\r\n this.createEvent({ 'url': url });\r\n }\r\n}", | |
"expected_receive_period_in_days": "2", | |
"expected_update_period_in_days": "2" | |
}, | |
"schedule": "never", | |
"keep_events_for": 3600, | |
"propagate_immediately": false | |
}, | |
{ | |
"type": "Agents::PhantomJsCloudAgent", | |
"name": "微信公众号 #5.1 获取文章列表", | |
"disabled": false, | |
"guid": "1acba94dd4d176c71d063b5baa741f95", | |
"options": { | |
"mode": "clean", | |
"api_key": "{% credential phantomjs_cloud %}", | |
"url": "{{url}}", | |
"render_type": "html", | |
"output_as_json_radio": "false", | |
"output_as_json": "false", | |
"ignore_images_radio": "false", | |
"ignore_images": "false", | |
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36", | |
"wait_interval": "1000" | |
}, | |
"schedule": "never", | |
"keep_events_for": 432000, | |
"propagate_immediately": false | |
}, | |
{ | |
"type": "Agents::DeDuplicationAgent", | |
"name": "微信公众号 #6 去除重复", | |
"disabled": false, | |
"guid": "3250efcc923ce4c10b30763c6e0365b6", | |
"options": { | |
"property": "{{title}}", | |
"lookback": "0", | |
"expected_update_period_in_days": "20" | |
}, | |
"keep_events_for": 15552000, | |
"propagate_immediately": true | |
}, | |
{ | |
"type": "Agents::WebsiteAgent", | |
"name": "微信公众号 #5.2 获取文章列表", | |
"disabled": false, | |
"guid": "606e3875f2368e053aace5f3d9ceeb9d", | |
"options": { | |
"expected_update_period_in_days": "20", | |
"url_from_event": "{{url}}", | |
"type": "html", | |
"mode": "on_change", | |
"extract": { | |
"url": { | |
"css": "h4", | |
"value": "@hrefs" | |
}, | |
"title": { | |
"css": "h4", | |
"value": "string(.)" | |
} | |
}, | |
"events_order": [ | |
[ | |
"{{_index_}}", | |
"number", | |
"true" | |
] | |
], | |
"template": { | |
"url": "{{ url | to_uri: \"http://mp.weixin.qq.com\" }}" | |
} | |
}, | |
"schedule": "never", | |
"keep_events_for": 7776000, | |
"propagate_immediately": true | |
}, | |
{ | |
"type": "Agents::WebsiteAgent", | |
"name": "微信公众号 #1 搜索账号", | |
"disabled": false, | |
"guid": "a4c7bc9e333c38cbb4fdfa3a24c191ed", | |
"options": { | |
"expected_update_period_in_days": "4", | |
"_comment": [ | |
"利器" | |
], | |
"url": [ | |
"https://weixin.sogou.com/weixin?type=1&query=liqiio&ie=utf8&s_from=input&_sug_=n&_sug_type_=" | |
], | |
"type": "html", | |
"mode": "on_change", | |
"template": { | |
"cookie": "{{ _response_.headers.Set-Cookie }}", | |
"refer": "{{ _url_ }}" | |
}, | |
"extract": { | |
"url": { | |
"css": "#sogou_vr_11002301_box_0 > div > div.txt-box > p.tit > a", | |
"value": "@href" | |
} | |
}, | |
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" | |
}, | |
"schedule": "every_1d", | |
"keep_events_for": 86400, | |
"propagate_immediately": false | |
}, | |
{ | |
"type": "Agents::DataOutputAgent", | |
"name": "微信公众号 #8 输出RSS", | |
"disabled": false, | |
"guid": "cbc2ced20c71d435a5bd375b3e580797", | |
"options": { | |
"secrets": [ | |
"weixin_public" | |
], | |
"expected_receive_period_in_days": "20", | |
"template": { | |
"title": "微信公众号", | |
"description": "微信公众号", | |
"item": { | |
"title": "【{{author}}】{{title}}", | |
"description": "{{ desciption | replace: 'data-src', 'src' }}", | |
"link": "{{url}}" | |
}, | |
"link": "https://weixin.sogou.com/", | |
"icon": "https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/common/favicon22c41b.ico" | |
}, | |
"ns_media": "true", | |
"events_to_show": "300" | |
}, | |
"propagate_immediately": true | |
}, | |
{ | |
"type": "Agents::JavaScriptAgent", | |
"name": "微信公众号 #2 按搜狗前端代码重新构造URL", | |
"disabled": false, | |
"guid": "e90d2135c2cf93c1dbc2b6e8b78bfee1", | |
"options": { | |
"language": "JavaScript", | |
"code": "Agent.receive = function() {\r\n var events = this.incomingEvents();\r\n for(var i = 0; i < events.length; i++) {\r\n // concat url\r\n var url = events[i].payload['url'];\r\n var b = Math.floor(100 * Math.random()) + 1\r\n , a = url.indexOf(\"url=\")\r\n , c = url.indexOf(\"&k=\");\r\n -1 !== a && -1 === c && (a = url.substr(a + 4 + parseInt(\"26\") + b, 1),\r\n url += \"&k=\" + b + \"&h=\" + a);\r\n events[i].payload['url'] = url;\r\n \r\n // extract SNUID cookie\r\n var re = /SNUID=\\w*/;\r\n var cookie = re.exec(events[i].payload['cookie'])[0];\r\n events[i].payload['cookie'] = cookie;\r\n \r\n // emit\r\n this.createEvent(events[i].payload);\r\n }\r\n}", | |
"expected_receive_period_in_days": "2", | |
"expected_update_period_in_days": "2" | |
}, | |
"schedule": "never", | |
"keep_events_for": 0, | |
"propagate_immediately": false | |
}, | |
{ | |
"type": "Agents::WebsiteAgent", | |
"name": "微信公众号 #7 获取单篇文章全文", | |
"disabled": false, | |
"guid": "f7c52fcd85cea0d7426978202f4dc692", | |
"options": { | |
"expected_update_period_in_days": "20", | |
"url_from_event": "{{url}}", | |
"type": "html", | |
"mode": "merge", | |
"extract": { | |
"desciption": { | |
"css": "#img-content", | |
"value": "./node()" | |
}, | |
"author": { | |
"css": "#js_name", | |
"value": "string(.)" | |
}, | |
"title": { | |
"css": "#activity-name", | |
"value": "string(.)" | |
} | |
} | |
}, | |
"schedule": "never", | |
"keep_events_for": 604800, | |
"propagate_immediately": true | |
} | |
], | |
"links": [ | |
{ | |
"source": 0, | |
"receiver": 1 | |
}, | |
{ | |
"source": 1, | |
"receiver": 2 | |
}, | |
{ | |
"source": 2, | |
"receiver": 4 | |
}, | |
{ | |
"source": 3, | |
"receiver": 8 | |
}, | |
{ | |
"source": 4, | |
"receiver": 3 | |
}, | |
{ | |
"source": 5, | |
"receiver": 7 | |
}, | |
{ | |
"source": 7, | |
"receiver": 0 | |
}, | |
{ | |
"source": 8, | |
"receiver": 6 | |
} | |
], | |
"control_links": [ | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PhantomJsCloudAgent 这个现在不能使用了、有代替的方案吗