Twitter - i only recieve 20 tweets from the user_timeline
var options = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json?',
qs: { "screen_name": "Screen_name"} ,
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
request(options, function(error, response, body){
console.log("length",body.length)
});
i am trying to get all tweets but for some reason i only get 20, eventought the api call can get up to 3200 tweets.
So i am wondering how can i get all the tweets of this account (currently 700+)
i saw a count being listed but for some reason i cant find a way to start a segment.
Hopefully someone can help me.
EDIT:
after the answer of pii_kee , i came to the conclusion that this is what needs to be done to get all tweets :
var firstOptions = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json',
qs: {"screen_name": "Company", "count": 200},
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
var array = ;
var go = true;
async.whilst(function () {
return go;
},function(next){
request(firstOptions, function (error, response, body) {
firstOptions.qs.max_id = body[body.length - 1].id;
array = array.concat(body);
if(body.length !== 200) {
go = false;
}
next();
});
});
node.js twitter
add a comment |
var options = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json?',
qs: { "screen_name": "Screen_name"} ,
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
request(options, function(error, response, body){
console.log("length",body.length)
});
i am trying to get all tweets but for some reason i only get 20, eventought the api call can get up to 3200 tweets.
So i am wondering how can i get all the tweets of this account (currently 700+)
i saw a count being listed but for some reason i cant find a way to start a segment.
Hopefully someone can help me.
EDIT:
after the answer of pii_kee , i came to the conclusion that this is what needs to be done to get all tweets :
var firstOptions = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json',
qs: {"screen_name": "Company", "count": 200},
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
var array = ;
var go = true;
async.whilst(function () {
return go;
},function(next){
request(firstOptions, function (error, response, body) {
firstOptions.qs.max_id = body[body.length - 1].id;
array = array.concat(body);
if(body.length !== 200) {
go = false;
}
next();
});
});
node.js twitter
Do you can show a common returning from twitter API? Maybe it return the next page path for a next API call.
– Lucas Costa
Nov 20 '18 at 13:46
@LucasCosta i have added a common response, i do not see a nextpage path listed anywhere.
– Lars Hendriks
Nov 20 '18 at 13:54
add a comment |
var options = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json?',
qs: { "screen_name": "Screen_name"} ,
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
request(options, function(error, response, body){
console.log("length",body.length)
});
i am trying to get all tweets but for some reason i only get 20, eventought the api call can get up to 3200 tweets.
So i am wondering how can i get all the tweets of this account (currently 700+)
i saw a count being listed but for some reason i cant find a way to start a segment.
Hopefully someone can help me.
EDIT:
after the answer of pii_kee , i came to the conclusion that this is what needs to be done to get all tweets :
var firstOptions = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json',
qs: {"screen_name": "Company", "count": 200},
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
var array = ;
var go = true;
async.whilst(function () {
return go;
},function(next){
request(firstOptions, function (error, response, body) {
firstOptions.qs.max_id = body[body.length - 1].id;
array = array.concat(body);
if(body.length !== 200) {
go = false;
}
next();
});
});
node.js twitter
var options = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json?',
qs: { "screen_name": "Screen_name"} ,
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
request(options, function(error, response, body){
console.log("length",body.length)
});
i am trying to get all tweets but for some reason i only get 20, eventought the api call can get up to 3200 tweets.
So i am wondering how can i get all the tweets of this account (currently 700+)
i saw a count being listed but for some reason i cant find a way to start a segment.
Hopefully someone can help me.
EDIT:
after the answer of pii_kee , i came to the conclusion that this is what needs to be done to get all tweets :
var firstOptions = {
method: 'GET',
url: 'https://api.twitter.com/1.1/statuses/user_timeline.json',
qs: {"screen_name": "Company", "count": 200},
json: true,
headers: {
"Authorization": "Bearer " + token.access_token
}
};
var array = ;
var go = true;
async.whilst(function () {
return go;
},function(next){
request(firstOptions, function (error, response, body) {
firstOptions.qs.max_id = body[body.length - 1].id;
array = array.concat(body);
if(body.length !== 200) {
go = false;
}
next();
});
});
node.js twitter
node.js twitter
edited Nov 21 '18 at 8:19
Lars Hendriks
asked Nov 20 '18 at 13:41
Lars HendriksLars Hendriks
56812
56812
Do you can show a common returning from twitter API? Maybe it return the next page path for a next API call.
– Lucas Costa
Nov 20 '18 at 13:46
@LucasCosta i have added a common response, i do not see a nextpage path listed anywhere.
– Lars Hendriks
Nov 20 '18 at 13:54
add a comment |
Do you can show a common returning from twitter API? Maybe it return the next page path for a next API call.
– Lucas Costa
Nov 20 '18 at 13:46
@LucasCosta i have added a common response, i do not see a nextpage path listed anywhere.
– Lars Hendriks
Nov 20 '18 at 13:54
Do you can show a common returning from twitter API? Maybe it return the next page path for a next API call.
– Lucas Costa
Nov 20 '18 at 13:46
Do you can show a common returning from twitter API? Maybe it return the next page path for a next API call.
– Lucas Costa
Nov 20 '18 at 13:46
@LucasCosta i have added a common response, i do not see a nextpage path listed anywhere.
– Lars Hendriks
Nov 20 '18 at 13:54
@LucasCosta i have added a common response, i do not see a nextpage path listed anywhere.
– Lars Hendriks
Nov 20 '18 at 13:54
add a comment |
1 Answer
1
active
oldest
votes
Try adding count: 200
in the qs
object to get about 200 tweets per request. To get older tweets you have to set the max_id
parameter properly, otherwise it will return most recent tweets only. Take a look at the reference of statuses/user_timeline
API endpoint for detailed meaning of these parameters.
Also, try reading this guide on working with timelines using this method.
I added my code that works for me to the answer. thanks for your help this did the trick. for some reason i missed the entire guide on the twitter website.
– Lars Hendriks
Nov 21 '18 at 8:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394342%2ftwitter-i-only-recieve-20-tweets-from-the-user-timeline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try adding count: 200
in the qs
object to get about 200 tweets per request. To get older tweets you have to set the max_id
parameter properly, otherwise it will return most recent tweets only. Take a look at the reference of statuses/user_timeline
API endpoint for detailed meaning of these parameters.
Also, try reading this guide on working with timelines using this method.
I added my code that works for me to the answer. thanks for your help this did the trick. for some reason i missed the entire guide on the twitter website.
– Lars Hendriks
Nov 21 '18 at 8:04
add a comment |
Try adding count: 200
in the qs
object to get about 200 tweets per request. To get older tweets you have to set the max_id
parameter properly, otherwise it will return most recent tweets only. Take a look at the reference of statuses/user_timeline
API endpoint for detailed meaning of these parameters.
Also, try reading this guide on working with timelines using this method.
I added my code that works for me to the answer. thanks for your help this did the trick. for some reason i missed the entire guide on the twitter website.
– Lars Hendriks
Nov 21 '18 at 8:04
add a comment |
Try adding count: 200
in the qs
object to get about 200 tweets per request. To get older tweets you have to set the max_id
parameter properly, otherwise it will return most recent tweets only. Take a look at the reference of statuses/user_timeline
API endpoint for detailed meaning of these parameters.
Also, try reading this guide on working with timelines using this method.
Try adding count: 200
in the qs
object to get about 200 tweets per request. To get older tweets you have to set the max_id
parameter properly, otherwise it will return most recent tweets only. Take a look at the reference of statuses/user_timeline
API endpoint for detailed meaning of these parameters.
Also, try reading this guide on working with timelines using this method.
edited Nov 21 '18 at 9:29
answered Nov 20 '18 at 20:32
pii_kepii_ke
1,2201019
1,2201019
I added my code that works for me to the answer. thanks for your help this did the trick. for some reason i missed the entire guide on the twitter website.
– Lars Hendriks
Nov 21 '18 at 8:04
add a comment |
I added my code that works for me to the answer. thanks for your help this did the trick. for some reason i missed the entire guide on the twitter website.
– Lars Hendriks
Nov 21 '18 at 8:04
I added my code that works for me to the answer. thanks for your help this did the trick. for some reason i missed the entire guide on the twitter website.
– Lars Hendriks
Nov 21 '18 at 8:04
I added my code that works for me to the answer. thanks for your help this did the trick. for some reason i missed the entire guide on the twitter website.
– Lars Hendriks
Nov 21 '18 at 8:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394342%2ftwitter-i-only-recieve-20-tweets-from-the-user-timeline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you can show a common returning from twitter API? Maybe it return the next page path for a next API call.
– Lucas Costa
Nov 20 '18 at 13:46
@LucasCosta i have added a common response, i do not see a nextpage path listed anywhere.
– Lars Hendriks
Nov 20 '18 at 13:54