Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent unnecessary fields from being included in Meetup results
  • Loading branch information
lpinca committed Apr 11, 2016
commit b5f1e0952dee61820fda1b7c7b025e892f3c66da
26 changes: 9 additions & 17 deletions events/pull-meetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,20 @@ const defaults = {
}
const results = []

function clean (event) {
delete event.topics
delete event.urlname
delete event.category
delete event.id
}

function finish (events) {
// return console.log(JSON.stringify(events))
events.forEach((event) => {
if (!countryMap[event.country]) {
console.log(event)
throw new Error('Do not have map for ' + event.country)
}
const region = yml.getRegion(countryMap[event.country])
if (!region.meetups) region.meetups = []
clean(event)
if (!yml.isSoT(region.meetups, event.city, event.name)) {
yml.replace(region.meetups, 'name', event.name, event)
}
})
yml.save()
}
// This is nice when testing if you cache the response
// finish(JSON.parse(require('fs').readFileSync('./meetup.json').toString()))

function pull (opts) {
request(opts, (err, resp, body) => {
Expand All @@ -47,9 +36,12 @@ function pull (opts) {
body.results.forEach((result) => {
const title = result.name.toLowerCase()

if (title.includes('nodeschool')) return
if (title.includes('mongodb') && title.includes('node')) return
if (title.includes('find a tech job') && title.includes('node')) return
if (
title.includes('find a tech job') ||
title.includes('nodeschool') ||
/ mongodb (?:user group|meet ?up)$/.test(title) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not title.includes('mongodb')?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there are some MongoDB+Node.js events.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also a lot of irrelevant events like Angular Ember etc but it's kinda hard to have ONLY relevant Node.js events. This a flaw in Meetup categories and topics.

title.startsWith('mongodb ')
) return

results.push(result)
})
Expand All @@ -65,9 +57,9 @@ function pull (opts) {
pull(Object.assign({
url: 'https://api.meetup.com/2/groups',
qs: {
only: 'city,country,description,group_photo.photo_link,lat,link,lon,name',
key: process.env.MEETUP_TOKEN,
upcoming_events: true,
topic: 'nodejs',
category: 34
topic: 'nodeJS',
category_id: 34 // tech
}
}, defaults))