pablobarbera / instaR

Dev version of instaR package: Access to Instagram API via R
106 stars 47 forks source link

Sandbox Error or Bug? #36

Closed ximhotep closed 7 years ago

ximhotep commented 8 years ago

I'm trying to test the functionality of instaR inside the Sandbox and received the following error when trying to run most commands:

For example, Running getFollowers on one of my Sandbox users returns: Error in content$data[[1]]$id : $ operator is invalid for atomic vectors

Running searchInstagram(tag="fall",token, n=10, folder="test") returns: 32 posts Error in x[[field]] : subscript out of bounds

Is this a result of the Sandbox or is this a result of something else?

Thank you. John

amadeimatti commented 8 years ago

John, I have the same problem...

ghost commented 8 years ago

Hi, I seem to have the same problem.

When you're in sandbox mode (which is the default) you don't have any permissions at all.

By the way, you have to add a company name, email and link to privacy policy to even unlock the abiloty to put permissions under review.

screen shot 2016-09-13 at 12 35 01

If you try to start a submission (even for public_content), no matter what reason you provide, they shut you down. There're only a couple that works, yet, not having an official privacy policy makes it pretty stupid to send it for review anyway. They also demand things like screencast of your app, etc.

screen shot 2016-09-13 at 12 35 14

In other words, it seems like Instagram made their API connection unusable unless you want to officially launch a business or something like that.

I may be missing something, but both Facebook's and Instagram's are so limited and enclosed that you might as well just scrape that data.. it's a pity

alanault commented 7 years ago

Hi,

I have the same error (Error in x[[field]] : subscript out of bounds) - but do I have a token which is out of sandbox, so I suspect this isn't the issue. When I build the URL manually and then paste into a browser, then I get the correct API output, so it seems its a error in processing the output.

Looking through the code x[[field]] seems to happen in the unlistWithNA function, so it's possible the API output has changed slightly which has thrown this off.

Let me know if it would be useful to send example output etc as likely this is just a parsing issue

Best Alan

alanault commented 7 years ago

Took a look through the source code - the issue seems to be in the searchListToDF funciton, which is trying to unlist the data to build a dataframe.

I suspect the API output was originally a nested list, which needed lots of parsing, however, now the content$data element is a dataframe, so the unlisting code falls over. By commenting out this step and just letting the dataframe flow through, I got a nice dataframe of posts back.

Two columns remain as lists ($tags and $users_in_photo'), both of which are ok for me as lists inside the dataframe.

For anyone else looking to make the same change, it's in getUserMedia line 76. I just commented this out and replaced with df <- content$data.

pablobarbera commented 7 years ago

@alanault Thanks so much for reporting this bug. Could you submit a pull request? Unfortunately I don't have access to a token out of sandbox anymore, so I cannot test this on my end. I'm probably going to take this package out of CRAN anyway, since it seems Instagram has been reluctant to approve apps for research purposes. (If you've had any success and would be willing to share your experience, either here or via email, I would also really appreciate it.)

MicheleVNG commented 7 years ago

Hi, I'm having the same problem as above, with a simple request:

> info <- getUser(username = MYUSERNAME, token = token)
Error in content$data[[1]]$id : $ operator is invalid for atomic vectors

Debugging the getUser() function I see that everything works up to line:

userid <- as.numeric(content$data[[1]]$id)

I think the [[1]] part is not necessary, in fact as.numeric(content$data$id) correctly returns the numeric ID.

Is this related to the Sandbox API account?

jonneguyt commented 7 years ago

Have been playing around with it and indeed the response from the API has changed. This appears in more than just the ones that @MicheleVNG has edited. I don't know if I'll have any chance to come up with a thorough update anytime soon though.

pensebien commented 6 years ago

I was having the same problem but this time with data I gathered from Google Analytics using RGoogleAnalytics Package. anytime(ga_data$date) date | sessions 20170705 1403 20170706 403 20170707 1103 20170708 2403

NabeelahB commented 6 years ago

I am facing the same issue. I have a token which is in the sandbox mode. It is able to pull in data fine for getUserMedia for my account but gives subscript out of bounds error for getcomments. Any help would be appreciated