-
-
Save pulsar256/f5621e85ef50711adc6f to your computer and use it in GitHub Desktop.
// workaround for https://code.google.com/p/gdata-issues/issues/detail?id=7163 | |
var d0 = "AEIMQUYcgkosw048"; | |
var d1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
var d2 = d1; | |
var d1c = 0; | |
var d2c = 0; | |
var overflowSuffix = "Q"; | |
var direction = "AA"; | |
var d2OverflowCounter = 0; | |
var pageSize = 50; | |
for(i = 0; i < 1024; i++) { | |
if(i % pageSize == 0) console.log("C" + d1.charAt((d1c / d0.length) % d1.length) + d0.charAt(i % d0.length) + overflowSuffix + direction, ":", i); | |
if(++d1c % (1 << 8) == 0) d1c = 1 << 7; | |
if(++d2c % (1 << 7) == 0) overflowSuffix = d2.charAt(++d2OverflowCounter) + "E"; | |
} |
i=400
isn't working. Token should be CJADEAA
but calculates CJAAEAA
pageSize = 50
i = 400
Further tests reviled that var d1 = "ABCDEFGHIJKLMNOP";
should be correct. After P
the iteration starts with I
again. So d1
has only a length of 16.
@bromix: the sequence is calculated correctly on my end, just pasted the code into the chrome dev console. gives me CJADEAA : 400. Please keep in mind that the algorithm is not very smart and requires to iterate beginning with 0.
And yes, you are right. d1 might be trimmed to [A..P] but d2 may not. I way lazy. Feel free to fork ;)
@Pulsar: thanks for the feedback...already figured it out for python. But your code was inspiring and a lot of help :) no need for iterations on my end now :)
awesome! ;)
even with the code examples above, i seem to get stuck at 46 pages (with a max of 50 per page). Can you get more than 46 pages returned?
I got stuck at page 22, after 1000 position. But it may be a mostake on my porting.@chuckstarl can you give a list of codes until 46?
This would be nice in Python with page and max_result as a parameter :)