-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
30 lines (30 loc) · 1.08 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const scrapper = require("./scrapper.js");
const Episode = require("./models/episode");
const mongoose = require("mongoose");
mongoose.Promise = global.Promise;
mongoose.connect("mongodb://emilio:[email protected]:19250/titans");
const R = require("ramda");
// scrapper
// .getEpisodesWithGuest()
// .then(eps => Promise.all(eps.map(e => Episode.create(e))))
// .then(_ => console.log("listo!"))
// .catch(e => console.log(e));
// Episode.find().then(eps => {
// const all = eps
// .filter(ep => !(ep.audioUrl && ep.billboardLocation))
// .reduce(
// (acc, ep) =>
// acc.then(_ =>
// scrapper
// .getAudioUrlAndBillboardLocation(ep.pageUrl)
// .then(data => ep.update(data))
// .then(console.log("got data for " + ep.guest))
// .catch(e => console.log(ep.pageUrl, e))),
// Promise.resolve()
// );
// });
// Episode.find().then(eps => {
// eps
// .filter(ep => !(ep.audioUrl && ep.billboardLocation))
// .forEach(ep => ep.remove().then(_ => console.log("removed ", ep.pageUrl)));
// });