Skip to content

Instantly share code, notes, and snippets.

@acatl
Last active March 2, 2017 15:11
Show Gist options
  • Save acatl/5d69f82456dcfa0cd6b9ebd36b731eeb to your computer and use it in GitHub Desktop.
Save acatl/5d69f82456dcfa0cd6b9ebd36b731eeb to your computer and use it in GitHub Desktop.
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