diff --git a/README.md b/README.md index 9d9ef8e..83747ea 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 # Search public timeline $ nofan user # Fetch user timeline diff --git a/cli.js b/cli.js index 9cd4fd1..229f3fb 100755 --- a/cli.js +++ b/cli.js @@ -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 Search public or user timeline trends|tr Fetch trends user Fetch user-timeline @@ -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'); diff --git a/src/nofan.js b/src/nofan.js index 798bd9a..e9ec742 100644 --- a/src/nofan.js +++ b/src/nofan.js @@ -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';