Skip to content

Commit

Permalink
Add support for fetching context-timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore committed Jun 13, 2020
1 parent dfcf06a commit 63f46bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CLI for Fanfou
- Fetch home-timeline
- Fetch public-timeline
- Fetch mentions-timeline
- Fetch context-timeline
- Fetch self-timeline
- Fetch user-timeline
- Fetch trends-timeline
Expand Down Expand Up @@ -65,6 +66,7 @@ $ nofan home|h # Fetch home timeline
$ nofan mentions|m # Fetch mentions timeline
$ nofan me # Fetch self timeline
$ nofan public|p # Fetch public timeline
$ nofan context|cont # Fetch context timeline
$ nofan trends|tr # Fetch trends timeline
$ nofan search|se <query> # Search public timeline
$ nofan user <id> # Fetch user timeline
Expand Down
9 changes: 9 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Commands:
mentions|m Show mentions
me Show my statuses
public|p Show public timeline
context|cont Show context timeline
search|se <query> Search public or user timeline
trends|tr Fetch trends
user <id> Fetch user-timeline
Expand Down Expand Up @@ -123,6 +124,14 @@ switch (commands[0]) {
break;
}

case 'context':
case 'cont': {
spinner('Fetch');
const [, id] = commands;
nofan.contextTimeline(id);
break;
}

case 'search':
case 'se': {
spinner('Fetching');
Expand Down
5 changes: 5 additions & 0 deletions src/nofan.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ class Nofan {
this._displayTimeline(statuses, {verbose: this.verbose});
}

async contextTimeline(id) {
const statuses = await this._get('/statuses/context_timeline', {id, format: 'html', ...this.params});
this._displayTimeline(statuses, {verbose: this.verbose});
}

async searchTimeline(q) {
const {DISPLAY_COUNT: count} = this.config;
const uri = this.params.id ? '/search/user_timeline' : '/search/public_timeline';
Expand Down

0 comments on commit 63f46bc

Please sign in to comment.