Jsonlite invalid char in json text.

Hi All,

I have a code that works fine on a local machine but when I use a VM it keeps getting an error.

hashtag <- "bbnaija"
url_start <- str_glue("http://instagram.com/explore/tags/{hashtag}/?__a=1")
json <- jsonlite::fromJSON(url_start)

It works fine on my local machine, but when I use a VM I keeping getting an error;
Error: lexical error: invalid char in json text.
<html lang="en"
(right here) ------^

Please help. Thank you

My first guess would be that, for some reason, accessing this page from the VM doesn't return a JSON but some generic html page. On the VM, try to download the content of that URL and see what's in it. I wouldn't be surprised if you got this:


Instagram decided that your VM's IP is suspicious and denied it access. (I got the screenshot when I tried from TOR).

1 Like

Yes, you're right. It's a firewall issue, just as you've observed. Is there a work around?

If it's really the IP that's suspicious to Instagram, you need to try from a different IP, maybe by respawning the VM or via a VPN. I don't know what else I could suggest I'm afraid.
Instagram might have a key-ed API, in which case it might not look at your IP as long as you have a valid key. Not sure.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.