Unexpected character json error in r

前端 未结 2 1970
清歌不尽
清歌不尽 2020-12-18 05:50

I\'m getting the following error message for this code intended to read Instagram posts into r. Other code is successfully reading in the first 20 posts, but Instagram want

2条回答
  •  不知归路
    2020-12-18 06:35

    I can reproduce your problem by extending your code snippet with code that extracts next_url from the pagination object in the JSON response returned by Instagram.

    When using rjson::fromJSON to parse the JSON response I get errors like

    Error in rjson::fromJSON(js) : unexpected character: i
    

    However, using RJSONIO::fromJSON for parsing the exact same string works just fine! Also the string validates as correct JSON with online JSON validators.

    This strongly points to a bug in rjson::fromJSON. You may want to use the RJSONIO package instead for now.

    Unfortunately these Instagram replies are quite large. I'll see if I can strip down the JSON output to something manageable so I can post details here. (I'm trying to avoid having to link to data on an external site.)

    I suspect an encoding issue with Instagram user names.

提交回复
热议问题