-
Notifications
You must be signed in to change notification settings - Fork 0
/
ht.js
executable file
·40 lines (34 loc) · 1.05 KB
/
ht.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
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env node
require('dotenv').config()
const program = require('commander')
const BestTags = require('./lib/bestTags')
const Followers = require('./lib/followers')
program.command('search <tag> [otherTags...]').action((tag, otherTags) => {
const allTags = [tag].concat(otherTags)
console.log('looking for ' + allTags.join(','))
BestTags(tag, 5)
.then(tags => {
console.dir(tags)
})
.catch((err, data) => {
console.dir(err)
console.dir(data)
})
})
program.command('followers <user> <filter...>')
.option('-c, --cursor <cursor>', 'an initial cursor', -1)
.action(async (user, filter, cmdObj) => {
console.log(filter)
console.log(cmdObj.cursor)
const followers = await Followers(user, filter.map(f => f.toLowerCase()))
console.dir(followers.map(f => ({
name: f.name,
screen_name: f.screen_name,
location: f.location,
description: f.description,
url: f.url,
twUrl: `https://twitter.com/${f.screen_name}`,
id: f.id_str
})))
})
program.parse(process.argv)