~ D:\workspace\nodejs>mkdir nodejs-alexa && cd nodejs-alexa
- ~ vi package.json
- {
- "name": "alexa-demo",
- "version": "0.0.1",
- "description": "alexa web demo",
- "license": "MIT",
- "dependencies": {
- "awis": "0.0.8"
- }
- }
- ~ D:\workspace\nodejs\nodejs-alexa>npm install
- npm WARN package.json alexa-demo@0.0.1 No repository field.
- npm WARN package.json alexa-demo@0.0.1 No README data
- alexarank@0.1.1 node_modules\alexarank
- ├── xml2js@0.4.13 (sax@1.1.4, xmlbuilder@3.1.0)
- └── request@2.30.0 (forever-agent@0.5.2, aws-sign2@0.5.0, qs@0.6.6, tunnel-agent@0.3.0, oauth-sign@0.3.0, json-stringify-safe@5.0.1, mime@1.2.11, node-uuid@1.4.3, tough-cookie@0.9.15, form-data@0.1.4, hawk@1.0.0, http-signature@0.10.1)
- awis@0.0.8 node_modules\awis
- ├── xml2js@0.4.13 (sax@1.1.4, xmlbuilder@3.1.0)
- ├── lodash@3.10.1
- └── request@2.65.0 (aws-sign2@0.6.0, forever-agent@0.6.1, caseless@0.11.0, stringstream@0.0.4, oauth-sign@0.8.0, tunnel-agent@0.4.1, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, node-uuid@1.4.3, qs@5.2.0, tough-cookie@2.2.0, combined-stream@1.0.5, mime-types@2.1.7, form-data@1.0.0-rc3, http-signature@0.11.0, hawk@3.1.0, bl@1.0.0, har-validator@2.0.2)
- ~ vi alexa.js
- // 定义AWS密钥
- var key = 'xxxxxxxxxxxxxxx';
- var sercet = 'xxxxxxxxxxxxxxx';
- // 创建awis实例化对象
- var awis = require('awis');
- var client = awis({
- key: key,
- secret: sercet
- });
- // 调用UrlInfo接口
- console.log("=============UrlInfo=================");
- client({
- 'Action': 'UrlInfo', //UrlInfo接口
- 'Url': 'fens.me', //查询的网站
- 'ResponseGroup': 'TrafficData,ContentData' //需要的数据组
- }, function (err, data) {
- if(err) console.log(err);
- console.log(data);
- });
- ~ D:\workspace\nodejs\nodejs-alexa>node alexa.js
- =============UrlInfo=================
- { contentData:
- { dataUrl: 'fens.me',
- siteData:
- { title: '粉丝日志',
- description: '跨界的IT博客|Hadoop家族, R, RHadoop, Nodejs, AngularJS, NoSQL, IT金融' },
- speed: { medianLoadTime: '982', percentile: '70' },
- adultContent: '',
- language: '',
- linksInCount: '198',
- keywords: '',
- ownedDomains: '' },
- trafficData:
- { dataUrl: 'fens.me',
- rank: '122616',
- usageStatistics: { usageStatistic: [Object] },
- contributingSubdomains: { contributingSubdomain: [Object] } } }
欢迎光临 冠富商务通中文社区 (http://gu1vhwx.nat.ipyingshe.com/news/) | Powered by Discuz! 3.0 |