Created
September 29, 2015 00:16
-
-
Save supersupermomonga/9dbdca0c361cd9219806 to your computer and use it in GitHub Desktop.
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
/* | |
* Feedly library for Google Apps Script | |
* @author Yoshiyuki Hirano <[email protected]> | |
* | |
*/ | |
/* constructs an Feedly service | |
* | |
* @constructor | |
* @param {string} url | |
* | |
* @return {Feedly} | |
*/ | |
function getInstance(url) { | |
return new Feedly(url); | |
} | |
/* constructs an Feedly service | |
* | |
* @constructor | |
* @param {string} url | |
* @throws {Object} | |
* @return {Feedly} | |
*/ | |
function Feedly(url) { | |
var regexp = /^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/; | |
if (typeof url != 'string' || !regexp.test(url)) throw new Error('Invalid URL'); | |
this.feedId = encodeURIComponent('feed/'+url); | |
} | |
/* get stats by feedId | |
* | |
* @return {Object} | |
*/ | |
Feedly.prototype.getStats = function () { | |
var response = UrlFetchApp.fetch('http://cloud.feedly.com/v3/feeds/'+this.feedId); | |
return JSON.parse(response); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment