Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7728589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:45:25+00:00 2026-06-01T05:45:25+00:00

I hope I’m overthinking this and there’s an obvious solution. From the API (GET

  • 0

I hope I’m overthinking this and there’s an obvious solution.

From the API (GET statuses/user_timeline)

max_id – Returns results with an ID less than (that is, older than) or equal to the specified ID.

“or equal to” means it will include the tweet with ID that I sent as my max_id parameter.

—

My question is this: if I store the id of my oldest tweet (from a previous request), how can I subtract 1 from this id to exclude it from being returned in my next request?

The obvious solution would be to do something like this ‘&max_id=’+lastID-1, but twitter IDs are way to large for such math operations and javascript rounds off the results.

Details about the snowflake update:
https://dev.twitter.com/docs/twitter-ids-json-and-snowflake

Posible solutions:

It has been mentioned that I can use the BigInteger Javascript Library: http://silentmatt.com/biginteger/, but in my opinion this is redundant for such as small task.

Do I have to use recursion on the string (id_str) and increment or decrement it by one? I hate to use a hack for such as small detail that should just work.

—

If you’ve had this problem please share your solution.

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:45:26+00:00Added an answer on June 1, 2026 at 5:45 am

    I ran into this same problem, and ended up solving it by subtracting 1 from the last digit, and then accounting for the scenario when we’re subtracting 1 from 0 via recursion.

    function decrementHugeNumberBy1(n) {
        // make sure s is a string, as we can't do math on numbers over a certain size
        n = n.toString();
        var allButLast = n.substr(0, n.length - 1);
        var lastNumber = n.substr(n.length - 1);
    
        if (lastNumber === "0") {
            return decrementHugeNumberBy1(allButLast) + "9";
        }
        else {      
            var finalResult = allButLast + (parseInt(lastNumber, 10) - 1).toString();
            return trimLeft(finalResult, "0");
        }
    }
    
    function trimLeft(s, c) {
        var i = 0;
        while (i < s.length && s[i] === c) {
            i++;
        }
    
        return s.substring(i);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hope to get solution to this problem. I have been stuck on it since
(Hope this doesn't get duplicated; second attempt at submitting this question) I'm working on
Hope anyone can shed light on this so I can use pens with dash
Hope I'm asking this correctly: I have a project Projects.Client I have my class
Hope this is the right place to be asking this, so my apologies if
Hope this is not a dupe. I would like to be able to do
Hope this isn't a waste of your time. I'm working on a project, and
Hope this makes sense, I am using Titanium mobile to build an iPhone app.
Hope you can help me with this one. I need to make a program
Hope this is possible- Have a table like so: Car_ID Brand Model Year ----------------------------------

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.