Created
May 21, 2015 17:17
-
-
Save pulsar256/f5621e85ef50711adc6f to your computer and use it in GitHub Desktop.
Generator for pageTokens for the Youtube API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"; | |
} |
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?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/bromix/d159787a63f9d7b00036