quora-api
v1.0.1
Published
An unofficial API for Quora
Downloads
20
Maintainers
Readme
:boom: :book: :boom: An unofficial API for Quora.
NOTE : Quora changes its UI almost every day. They make changes, they revert it back. This is what they are doing.
This code worked very well on old structure, but now some of the feature aren't working well. Also, Quora removed few sections
like Highlights
and Views
but this api contains that part which is quite useless at this point of time.
Install
$ npm install --save quora-api
Usage
PART 1
:
STATS
› Basic Information :
quora()
accepts : username
'use strict';
const quora = require('quora-api');
quora('Adam-DAngelo').then(user => {
console.log(user);
/*
{ profilePicture: 'https://qph.ec.quoracdn.net/...yqigr.jpeg',
biography: 'Quora CEO',
fullBio: null,
publicAnswers: '956',
questions: '951',
posts: '60',
followers: '160,138',
following: '619',
edits: '21,076',
monthlyViews: '383,356',
totalViews: '16,488,317' }
*/
});
› Knows About :
quora.knowsAbout()
accepts : username
quora.knowsAbout('Adam-DAngelo').then(user => {
console.log(user);
/*
{ knowsAbout1: 'Startups',
answers1: '63',
endorsement1: '95',
knowsAbout2: 'Quora (company)',
answers2: '37',
endorsement2: '268',
knowsAbout3: 'California Institute of Technology',
answers3: '9',
endorsement3: '48' }
*/
});
› Highlights :
quora.highlights()
accepts : username
quora.hightlights('Adam-DAngelo').then(info => {
console.log(user);
/*
{ info1: 'Top Writer',
part1: '2016, 2015, 2014, and 2013',
info2: 'Knowledge Prize Winner',
part2: 'Insert a dynamic date here',
info3: 'Published Writer',
part3: 'Forbes',
info4: 'Most Viewed Writer',
part4: ' Palo Alto, CA, Quora, California Institute of Technology, and 29 more' }
*/
});
PART 2
:
BLOGS & ANSWERS
› General answers :
quora.answer()
accepts : question
[without https://quora.com/]
answer's count : 5 (max)
quora.answer('What-is-JavaScript').then(answer => {
console.log(answer);
/*
{ answer0: 'Well, when you go to a.....case of AJAX calls, etc',
writer0: 'Josh Beam',
answer1: 'Your intuition about Javascript.....great JS codes',
writer1: 'Justen Robertson',
answer2: 'As stated in this..... page JavaScript: JavaScript',
writer2: 'Yassine Alouini',
answer3: 'JavaScript is a prog.... JSalert(\'Hello, world!\');'
writer3: 'Faizaan Mohammed';
answer4: 'I strongly suggest you to read.....ES6 and Beyond.',
writer4: ''Kim Gysen' }
/*
});
› User's answer :
quora.answer.user()
accepts : question along with writer's name
quora.answer.user('What-was-the-first-program-Adam-DAngelo-wrote/answer/Adam-DAngelo').then(answer => {
console.log(answer);
/*
{ answer: 'I'm not sure if I remember exactly. . . about programming' }
/*
});
› Total answers on a question :
quora.answer.count()
accepts : question
quora.answer.count('Where-do-Congressmen-and-Senators-live-when-they-are-in-DC').then(count => {
console.log(count);
// { count: '8 Answers' }
});
› User's total blog :
quora.blogCount()
accepts : username
quora.blogCount('Adam-DAngelo').then(count => {
console.log(count);
// { blog: '16 Blogs' }
});
PART 3
:
USER's ACTIVITIES
› Track last 5 activities :
quora.activity()
accepts : username
quora.activity('Adam-DAngelo').then(track => {
console.log(track);
/*
{ question0: 'Where do Congressmen and Senators live when they are in DC?',
action0: ' Adam D\'Angelo upvoted this · 18h ago',
.
.
question4: 'Is service (at restaurants, stores, taxis, etc.) good or bad in Israel?',
action4: 'Adam D\'Angelo upvoted this · 1d ago' }
*/
});
››
You can also use :
›
quora.activity.asked(username) :
last 5 questions asked by an user
quora.activity.asked(username).then(data => {
console.log(data);
// => get data
});
›
quora.activity.answered(username) :
last 5 questions answered by an user
quora.activity.answered(username).then(data => {
console.log(data);
// => get data
});
Options
››
Datas of section "Basic Information"
can also be scrapped individually
›
quora.profileImage(username)
: get username of a quora user
›
quora.bio(username)
: get initial biography
›
quora.fullBio(username)
: get complete biography
›
quora.publicAnswers(username)
: total publically answered question's count
›
quora.questions(username)
: total publically asked questions's count
›
quora.posts(username)
: total blog posts made
›
quora.followers(username)
: total number of followers
›
quora.following(username)
: total following
›
quora.edits(username)
: total edits made by a user
›
quora.monthlyViews(username)
: views generated on user's answer - monthly
›
quora.totalViews(username)
: views generate on user's answers - all time
username
TYPE :
string
Contributing
Feel free to submit a pull request or an issue! :hearts:
License
MIT © Rishi Giri