{"action":"created","issue":{"url":"https://api.github.com/repos/instabot-py/instabot.py/issues/438","repository_url":"https://api.github.com/repos/instabot-py/instabot.py","labels_url":"https://api.github.com/repos/instabot-py/instabot.py/issues/438/labels{/name}","comments_url":"https://api.github.com/repos/instabot-py/instabot.py/issues/438/comments","events_url":"https://api.github.com/repos/instabot-py/instabot.py/issues/438/events","html_url":"https://github.com/instabot-py/instabot.py/issues/438","id":216977337,"number":438,"title":"[SOLUTION] for ValueError: No JSON object could be decoded while using bot.","user":{"login":"fireuniversal","id":26673122,"avatar_url":"https://avatars1.githubusercontent.com/u/26673122?v=3","gravatar_id":"","url":"https://api.github.com/users/fireuniversal","html_url":"https://github.com/fireuniversal","followers_url":"https://api.github.com/users/fireuniversal/followers","following_url":"https://api.github.com/users/fireuniversal/following{/other_user}","gists_url":"https://api.github.com/users/fireuniversal/gists{/gist_id}","starred_url":"https://api.github.com/users/fireuniversal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fireuniversal/subscriptions","organizations_url":"https://api.github.com/users/fireuniversal/orgs","repos_url":"https://api.github.com/users/fireuniversal/repos","events_url":"https://api.github.com/users/fireuniversal/events{/privacy}","received_events_url":"https://api.github.com/users/fireuniversal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-03-25T14:22:46Z","updated_at":"2017-04-03T11:12:09Z","closed_at":"2017-03-29T15:30:17Z","body":"**Solution** for those who are facing **\"ValueError: No JSON object could be decoded\"** while running the python insta bot.\r\nThis happens when the bot tries to verify comment and gets failed.\r\n\r\nProblem looks like this in console\r\n![exception](https://cloud.githubusercontent.com/assets/26673122/24323014/00aa2d3e-1195-11e7-807e-6427b1291295.JPG)\r\n\r\n**Steps:**\r\nOpen file \"instabot.py\".\r\nPress **Control+f** keys and in search box type -> **check_exisiting_comment(self, media_code)**\r\nThen the problem code will appear like this:\r\n\r\n`\r\n        \r\n\r\n    def check_exisiting_comment(self, media_code):\r\n        url_check = self.url_media_detail % (media_code)\r\n        check_comment = self.s.get(url_check)\r\n\r\n        all_data = json.loads(check_comment.text)\r\n        if all_data['media']['owner']['id'] == self.user_id:\r\n                self.write_log(\"Keep calm - It's your own media ;)\")\r\n                del self.media_by_tag[0]\r\n                return True\r\n\r\n        comment_list = list(all_data['media']['comments']['nodes'])\r\n        for d in comment_list:\r\n            if d['user']['id'] == self.user_id:\r\n                self.write_log(\"Keep calm - Media already commented ;)\")\r\n                del self.media_by_tag[0]\r\n                return True\r\n\r\n        return False\r\n`\r\n\r\n> All you have to do is to copy the following code and replace with the old one.\r\n\r\n**Corrected code:**\r\n`\r\n        \r\n\r\n    def check_exisiting_comment(self, media_code):\r\n        url_check = self.url_media_detail % (media_code)\r\n        check_comment = self.s.get(url_check)\r\n\r\n        if not check_comment.text:\r\n            self.write_log(\"Failed to get comment info - not leaving comment\")\r\n            # There was a problem getting comment info, assume comment exists to avoid duplicates\r\n            return True\r\n        try:\r\n            all_data = json.loads(check_comment.text)\r\n            if all_data['media']['owner']['id'] == self.user_id:\r\n                self.write_log(\"Keep calm - It's your own media ;)\")\r\n                del self.media_by_tag[0]\r\n                return True\r\n\r\n            comment_list = list(all_data['media']['comments']['nodes'])\r\n            for d in comment_list:\r\n                if d['user']['id'] == self.user_id:\r\n                    self.write_log(\"Keep calm - Media already commented ;)\")\r\n                    del self.media_by_tag[0]\r\n                    return True\r\n        except:\r\n            self.write_log(\"Exception parsing comments json - not leaving comment\")\r\n            return True\r\n\r\n        return False\r\n`\r\n\r\nJust replace the code and then the bot will run fine.\r\nGive a like if this helps.\r\nThanks 👍 "},"comment":{"url":"https://api.github.com/repos/instabot-py/instabot.py/issues/comments/291113720","html_url":"https://github.com/instabot-py/instabot.py/issues/438#issuecomment-291113720","issue_url":"https://api.github.com/repos/instabot-py/instabot.py/issues/438","id":291113720,"user":{"login":"ChipWolf","id":3164166,"avatar_url":"https://avatars2.githubusercontent.com/u/3164166?v=3","gravatar_id":"","url":"https://api.github.com/users/ChipWolf","html_url":"https://github.com/ChipWolf","followers_url":"https://api.github.com/users/ChipWolf/followers","following_url":"https://api.github.com/users/ChipWolf/following{/other_user}","gists_url":"https://api.github.com/users/ChipWolf/gists{/gist_id}","starred_url":"https://api.github.com/users/ChipWolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChipWolf/subscriptions","organizations_url":"https://api.github.com/users/ChipWolf/orgs","repos_url":"https://api.github.com/users/ChipWolf/repos","events_url":"https://api.github.com/users/ChipWolf/events{/privacy}","received_events_url":"https://api.github.com/users/ChipWolf/received_events","type":"User","site_admin":false},"created_at":"2017-04-03T11:12:09Z","updated_at":"2017-04-03T11:12:09Z","body":"https://help.github.com/articles/creating-a-pull-request/ @fireuniversal "}}
{"actor":{"display_login":"ChipWolf"}}