yurilaaziz / neo-instabot

Neo-Instabot is a free project. Forked from instabot.py. It uses the Instagram Web/Mobile API.
Other
37 stars 22 forks source link

json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 82 (char 81) in 0.5.10 #7

Closed bijanzd closed 5 years ago

bijanzd commented 5 years ago

evertime i use bot for commenting after 3 or 4 comment this error disappear !

2019-08-24 19:58:52,915 - username - InstaBot - DEBUG - Retrieved 71 medias 2019-08-24 19:58:52,953 - username - InstaBot - DEBUG - Select 486 medias to process. Increase max_like_for_one_tag value for more processing medias Traceback (most recent call last): File "/usr/bin/instabot-py", line 10, in sys.exit(main()) File "/usr/lib/python3.7/site-packages/instabot/main.py", line 344, in main bot.run() File "/usr/lib/python3.7/site-packages/instabot/bot.py", line 740, in run self.new_auto_mod_comments(media) File "/usr/lib/python3.7/site-packages/instabot/bot.py", line 1008, in new_auto_mod_comments if self.iteration_ready("comments") and self.verify_media_before_comment(media): File "/usr/lib/python3.7/site-packages/instabot/bot.py", line 1060, in verify_media_before_comment all_data = json.loads(raw_data)["entry_data"]["PostPage"][0] File "/usr/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 82 (char 81)

thanks for your help !

CONFIG:

login: username
password: password
debug: 0
ban_sleep_time: 10800
comment_list: ["hello"]
comments_per_day: 10
comments_per_run: '{{comments_per_day}}'
config:
  file: instabot.config.yml
database:
  connection_string: sqlite:///{{database.path}}
  path: '{{login}}.db'
  type: sql
debug: 0
end_at_h: 23
end_at_m: 59
error_400_to_ban: 3
follow_per_day: 0
follow_per_run: 0
follow_time: 36000
follow_time_enabled: true
like_per_day: 0
like_per_run: 0
list_of_ua:
- Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; FSL 7.0.6.01001)
- Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; FSL 7.0.7.01001)
- Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; FSL 7.0.5.01003)
- Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0
- Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid)
  Firefox/3.6.8
- Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1
- Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
- Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid)
  Firefox/3.6.8
- Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
- Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
- Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727;
  .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
- Opera/9.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.01
- Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
- Mozilla/5.0 (Windows NT 5.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1
- Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.02
- Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112
  Safari/535.1
- Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition
  [en]
log_mod: 0
logging:
  disable_existing_loggers: false
  formatters:
    simple:
      format: '%(asctime)s - {{login}} - %(name)s - %(levelname)s - %(message)s'
  handlers:
    console:
      class: logging.StreamHandler
      formatter: simple
      level: DEBUG
      stream: ext://sys.stdout
  loggers:
    InstaBot:
      handlers:
      - console
      level: DEBUG
      propagate: 'no'
    Persistence:
      handlers:
      - console
      level: DEBUG
      propagate: 'no'
  root:
    level: INFO
  version: 1
max_like_for_one_tag: 150
media_max_like: 0
media_min_like: 1
session_file: '{{login}}.session'
start_at_h: 0
start_at_m: 0
tag_blacklist: []
tag_list: ["cat"]
time_till_unlike: 259200
unfollow_break_max: 17
unfollow_break_min: 3
unfollow_everyone: false
unfollow_inactive: true
unfollow_not_following: true
unfollow_per_day: 0
unfollow_per_run: 0
unfollow_probably_fake: true
unfollow_recent_feed: false
unfollow_selebgram: false
unfollow_whitelist: []
unlike_per_day: 0
unlike_per_run: 0
unwanted_username_list: []
user_blacklist: {}
user_max_follow: 0
user_min_follow: 0
window_check_every: 300
bijanzd commented 5 years ago

Anybody help !

artgolwebdev commented 5 years ago

Do you use proxy ? It seems to me to work with proxy!!! I got the same error before I used proxyyy..

bijanzd commented 5 years ago

Do you use proxy ? It seems to me to work with proxy!!! I got the same error before I used proxyyy..

No i'am not use proxy ! every 4 or 5 comment, bot has crash !

artgolwebdev commented 5 years ago

Mine seems to me back to work after I defined proxy like this in the configuration file : proxies: http: '{{ proxy_http_string if (proxy_ip and proxy_port)}}' https: '{{ proxy_http_string if (proxy_ip and proxy_port)}}'

But the question is how long will it work with proxy...

artgolwebdev commented 5 years ago

crashed again with error ... json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 6815 (char 6814)

bijanzd commented 5 years ago

doesn't work correctly !!!!

artgolwebdev commented 5 years ago

So! After digging into code I figured out that it could not retrieve json in verify_media_before_comment function where I added simple try and catch in line 1060 bot.py file try: all_data = json.loads(raw_data)["entry_data"]["PostPage"][0] except Exception as exc: self.logger.warning("Cannot retrieve comments from media.(all_data) ") self.logger.exception(exc) return False

And my bot continued to run !!! This is the log (I define debug: 1 in confiuration file)

2019-08-27 16:34:11,665 - artyom.js - InstaBot - INFO - Followed: https://www.instagram.com/thevandalhour/ #1. 2019-08-27 16:34:12,135 - artyom.js - InstaBot - WARNING - Cannot retrieve comments from media.(all_data) 2019-08-27 16:34:12,136 - artyom.js - InstaBot - ERROR - Unterminated string starting at: line 1 column 2237 (char 2236) Traceback (most recent call last): File "c:\users\roey\appdata\local\programs\python\python37\lib\site-packages\instabot\bot.py", line 1062, in verify_media_before_comment all_data = json.loads(raw_data)["entry_data"]["PostPage"][0] File "c:\users\roey\appdata\local\programs\python\python37\lib\json__init__.py", line 348, in loads return _default_decoder.decode(s) File "c:\users\roey\appdata\local\programs\python\python37\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "c:\users\roey\appdata\local\programs\python\python37\lib\json\decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 2237 (char 2236) 2019-08-27 16:34:12,683 - artyom.js - InstaBot - INFO - Trying to comment: 2119724541454582423 https://www.instagram.com/p/B1qxj1bFAKX/ 2019-08-27 16:34:15,007 - artyom.js - InstaBot - INFO - Comment: The picture feels very cool... #1.

bijanzd commented 5 years ago

it work now ??

artgolwebdev commented 5 years ago

yep for more than 2 hours without exiting

artgolwebdev commented 5 years ago

Yes, where it tries to retrieve json all_data we put it in "try" "catch" so bot will continue to run...