, blocks wherever necessary of at least 1200 words in informational tone and as a first-person plural (we, us, our, ours) based on the following Instagram post: {post_data['caption']} \n\n Please don't add any hallucinated information about Farmonaut. To add any more details in the blog related to Farmonaut, use information from this text: {farmonaut_info} \n\n Try to incorporate these keywords into the blog: {keywords}. If any of the keywords look unrelated and out of context, then don't add them to the blog. Add Images (URLs) from this JSON object {post_data['media']} into the blog in blocks wherever necessary including the absolute top of the blog. If it matches with the theme of the blog, add a table of how Farmonaut Satellite System is better than drone and IoT based farm monitoring. Add links to https://farmonaut.com/app_redirect, https://sat.farmonaut.com/api, https://play.google.com/store/apps/details?id=com.farmonaut.android, https://apps.apple.com/in/app/farmonaut/id1489095847, https://farmonaut.com/farmonaut-satellite-weather-api-developer-docs/ wherever necessary. Include this custom HTML code for subscribing to Farmonaut: {stripe_html} \n Please include an FAQ section as well." blog_content = call_genai(prompt, 1, 4000) print(blog_content) category_ids = "blogs: 5, case_study:546, area_estimation:542, remote_sensing:9, precision_farming:548, api_development:572, usa:561" prompt = f'Based upon this title: {title} , identify the best category id in which this title fits in: {category_ids}. Strictly only return the integer value as the response' category_id = call_genai(prompt, 0, 5) try: category_id = int(category_id) except: category_id = 5 publish_to_wordpress(title, blog_content, post_data['media'], post_data['caption'], category_id) try: remove_keywords(string_to_array(keywords), 'final_keywords.xlsx', 'Sheet1', 'Keywords') except: print(traceback.format_exc()) good_count = good_count + 1 posts_done.append(post.get('shortCode', good_count)) save_to_file('posts_done.txt', str(posts_done)) except: print(traceback.format_exc()) bad_count = bad_count + 1 posts_failed.append(post.get('shortCode', bad_count)) save_to_file('posts_failed.txt', str(posts_failed)) time.sleep(15*60) total_count = total_count + 1 print(total_count, good_count, bad_count) save_to_file('last_post.txt', post.get('shortCode', total_count)) time.sleep(15*60) main()