Last active
March 2, 2017 15:11
-
-
Save acatl/5d69f82456dcfa0cd6b9ebd36b731eeb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function getPageTitle(ctx, done) { | |
const data = ctx.value; | |
const regex = new RegExp(/title>(.*?)<\/title>/g); | |
const title = data.match(regex); | |
done(null, {title: title}); | |
} | |
exports = { | |
"source:everything": { | |
"url": "http://api.nick.com/api/v2/tv-schedule/?apiKey=nickjr.com&numberOfDays=2", | |
}, | |
"model:filtered": { | |
"before": "source:everything", | |
"context": "$results", | |
"map": { | |
"title": (ctx, done) => { | |
done(null, _.toUpper(_.get(ctx, 'value.seriesTitle'))); | |
}, | |
"idParts": (ctx, done) => { | |
var id = _.get(ctx, 'value.id'); | |
var parts = id.split('-') || []; | |
done(null, parts); | |
}, | |
"rating": "$rating" | |
} | |
}, | |
"source:google": { | |
"url": "http://www.google.com", | |
"after": getPageTitle | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment