How can I Improve validation / performance for non-stop and start over the last item?

I want to improve my logic in this simple script that if stops or crashes or re-execute the script then start over from the last recorded item in the JSON, and find in the bulk link the position to start again from that, but my question. how can I properly handle this to do a non-stop?

      try:
        demo = feedparser.parse(url)
        feed.append(demo)
        data['news'].append({
          'url': url,
          'version': demo.version,
        })
        with open('json.json', 'r') as json_file:
          load_data = json.load(json_file)
          for p in load_data['news']:
            print(len(p['url']))
            if len(p['url']) < 1:
              with open('json.json', 'a+') as rss:
                json.dump(data, rss)
            elif load_data['news'][-1]['url'] in url:
              load_data['news'][-1]['url']
      except Exception as e:
        print(e)


Read more here: https://stackoverflow.com/questions/64528757/how-can-i-improve-validation-performance-for-non-stop-and-start-over-the-last

Content Attribution

This content was originally published by Raul Delgado de Luna at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: