Guest User

PhantomJs Cloud Demo - 2

a guest
May 4th, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 3.93 KB | None | 0 0
  1. {
  2.   "schema_version": 1,
  3.   "name": "PhantomJs Cloud Demo",
  4.   "description": "Example usage with PhantomJs Cloud (https://phantomjscloud.com/).\r\nYou'll need to sign up and get an API key for this to work.",
  5.   "source_url": false,
  6.   "guid": "32329783da28399392645cff5a14ab9f",
  7.   "tag_fg_color": "#ffffff",
  8.   "tag_bg_color": "#5bc0de",
  9.   "exported_at": "2016-05-04T18:56:54Z",
  10.   "agents": [
  11.     {
  12.       "type": "Agents::DataOutputAgent",
  13.       "name": "PhantomJS Cloud - Out - RSS",
  14.       "disabled": false,
  15.       "guid": "37094003a5077e78ec3114a475d2382c",
  16.       "options": {
  17.         "secrets": [
  18.           "phantom"
  19.         ],
  20.         "expected_receive_period_in_days": 2,
  21.         "template": {
  22.           "title": "XKCD comics as a feed",
  23.           "description": "This is a feed of recent XKCD comics, generated by Huginn",
  24.           "item": {
  25.             "title": "{{title}}",
  26.             "description": "{{body}}"
  27.           }
  28.         }
  29.       },
  30.       "keep_events_for": 3600,
  31.       "propagate_immediately": false
  32.     },
  33.     {
  34.       "type": "Agents::WebsiteAgent",
  35.       "name": "PhantomJS Cloud - Process - Fetch Page",
  36.       "disabled": false,
  37.       "guid": "3bc94a9d728abd43439c797518089513",
  38.       "options": {
  39.         "expected_update_period_in_days": "2",
  40.         "url_from_event": "https://PhantomJsCloud.com/api/browser/v2/{%credential phantomjs_cloud%}/?request={{url}}",
  41.         "type": "html",
  42.         "mode": "on_change",
  43.         "extract": {
  44.           "title": {
  45.             "css": "title",
  46.             "value": "normalize-space(.)"
  47.           },
  48.           "body": {
  49.             "css": "body #comic",
  50.             "value": "./node()"
  51.           }
  52.         }
  53.       },
  54.       "schedule": "every_1d",
  55.       "keep_events_for": 3600,
  56.       "propagate_immediately": true
  57.     },
  58.     {
  59.       "type": "Agents::EventFormattingAgent",
  60.       "name": "PhantomJS Cloud - Process - Format",
  61.       "disabled": false,
  62.       "guid": "3d0bed6bac1892bea2f8e440e44c58b8",
  63.       "options": {
  64.         "instructions": {
  65.           "message": {
  66.             "url": "{{url}}",
  67.             "renderType": "html",
  68.             "requestSettings": {
  69.               "userAgent": "Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+"
  70.             }
  71.           }
  72.         },
  73.         "mode": "clean"
  74.       },
  75.       "keep_events_for": 3600,
  76.       "propagate_immediately": true
  77.     },
  78.     {
  79.       "type": "Agents::RssAgent",
  80.       "name": "PhantomJS Cloud - In - RSS",
  81.       "disabled": false,
  82.       "guid": "9feb8ef94dc8f8fe6d4f0c5740abb00d",
  83.       "options": {
  84.         "expected_update_period_in_days": "5",
  85.         "clean": "true",
  86.         "url": "http://xkcd.com/rss.xml"
  87.       },
  88.       "schedule": "every_1d",
  89.       "keep_events_for": 3600
  90.     },
  91.     {
  92.       "type": "Agents::JavaScriptAgent",
  93.       "name": "PhantomJS Cloud - Process - JS Escape",
  94.       "disabled": false,
  95.       "guid": "e22d083a6fa306ac83692095a11221ce",
  96.       "options": {
  97.         "language": "JavaScript",
  98.         "code": "Agent.receive = function() {\r\n  var events = this.incomingEvents();\r\n  for(var i = 0; i < events.length; i++) {\r\n    var js = JSON.stringify(events[i].payload.message);\r\n    this.log('Message to escape: ' + js);\r\n    this.createEvent({ 'url': encodeURIComponent(js) });\r\n    var callCount = this.memory('callCount') || 0;\r\n    this.memory('callCount', callCount + 1);\r\n  }\r\n}",
  99.         "expected_receive_period_in_days": "2",
  100.         "expected_update_period_in_days": "2"
  101.       },
  102.       "schedule": "never",
  103.       "keep_events_for": 3600,
  104.       "propagate_immediately": true
  105.     }
  106.   ],
  107.   "links": [
  108.     {
  109.       "source": 1,
  110.       "receiver": 0
  111.     },
  112.     {
  113.       "source": 2,
  114.       "receiver": 4
  115.     },
  116.     {
  117.       "source": 3,
  118.       "receiver": 2
  119.     },
  120.     {
  121.       "source": 4,
  122.       "receiver": 1
  123.     }
  124.   ],
  125.   "control_links": [
  126.  
  127.   ]
  128. }
Add Comment
Please, Sign In to add comment