vineapple icon indicating copy to clipboard operation
vineapple copied to clipboard

[Error: SyntaxError: Unexpected number]

Open mbejda opened this issue 11 years ago • 8 comments

I keep getting this error when I'm trying to get the users feed. [Error: SyntaxError: Unexpected number]

vine.login(loginEmail, loginPassword, function (error, client) { console.log(client) /// user information shows up. Authenti

vine.user('958614911402057728',{page:1,size:10},function(e,c) { console.log(e) /////error is here console.log(c) //// })

});

mbejda avatar Dec 19 '13 14:12 mbejda

We forked the vinapple and and we think we fixed it. In the vineapple.js we removed line 121 and it worked fine.

mbejda avatar Dec 19 '13 17:12 mbejda

Can you post a gist containing the native response? Originally, Vine was returning IDs greater than 32 bit as numbers. They would not parse properly, so I was wrapping them in quotes and casting them to strings before parsing. It is possible they changed something. I'd love to see what you're seeing as I've been unable to replicate here.

furf avatar Dec 19 '13 17:12 furf

https://gist.github.com/mbejda/8043214

Notice the strange integers appearing outside the quotes. Line 18, Line 25, ...exc

mbejda avatar Dec 19 '13 17:12 mbejda

@mbejda Thanks for your fix. I had the same problem.

DaftMonk avatar Jan 04 '14 06:01 DaftMonk

@mbejda same here, commenting out line 121 solve the error: . [Error: SyntaxError: Unexpected number]

judikdavid avatar Feb 05 '14 10:02 judikdavid

+1 fix it please!

EggDice avatar Feb 11 '14 14:02 EggDice

Better than commenting line 121, you should replace line 21 with:

var VINE_ID_SEARCH = /("(?:(?:(?:comment|like|post|tag|user|venue)I)|i)d":\s*)(\d*)(,)?/g;

The problem is some of these ids are not 18 chars length, so the parsed result looks like: {..., postId: "123456789012345678"9, ...} and JSON.parse function does not like it.

Replacing line 21 with the code above has corrected the problem for me and I'm able to use those big Ids as strings.

benomite avatar Apr 16 '14 09:04 benomite

This was comitted in https://github.com/furf/vineapple/commit/9c71f2e45f306a517b6cfcfb3ef8e804918e3f81 and is now solved if anyone is feeling scared off

jspri avatar Jun 20 '15 04:06 jspri