Reverse Prompt Engineering Code (forked)

Fork
[import requests from bs4 import BeautifulSoup import pandas as pd class WebScraper: def get_html_content(self, url): response = requests.get(url) if response.status_code == 200: return response.content else: raise Exception("Failed to retrieve data from the website.") def extract_recommendations(self, html_content): soup = BeautifulSoup(html_content, "html.parser") recommendations = soup.find_all("div", class_="user-recommendation") extracted_data = [] for recommendation in recommendations: opportunity_title = recommendation.find("h3").text.strip() opportunity_description = recommendation.find("p").text.strip() affiliate_link = recommendation.find("a")["href"] recommendation_data = { "Title": opportunity_title, "Description": opportunity_description, "Affiliate Link": affiliate_link } extracted_data.append(recommendation_data) return pd.DataFrame(extracted_data) def scrape_goodreads_recommendations(self): url = "https://www.goodreads.com" # Replace with the desired Goodreads page URL html_content = self.get_html_content(url) recommendations = self.extract_recommendations(html_content) return recommendations # Usage example web_scraper = WebScraper() # Scrape recommendations from Amazon amazon_html_content = web_scraper.get_html_content("https://www.amazon.com") amazon_recommendations = web_scraper.extract_recommendations(amazon_html_content) print("Amazon Recommendations:") print(amazon_recommendations) # Scrape book recommendations from Goodreads goodreads_recommendations = web_scraper.scrape_goodreads_recommendations() print("Goodreads Book Recommendations:") print(goodreads_recommendations) I want to use reverse prompt engineering, where you help me create prompts based on code I give you that would be optimized and ideal for producing similar code.
can you give me an example of reverse prompt engineering? make sure the reverse prompt starts with "Write" and be as detailed and specific as possible, I am expecting your output to be polished and not need any revisions but general enough to get the task done
Now I want you to reverse prompt engineer the {code}. Give me a single prompt that would create a similar output. code = [code]
[format your response without using using markdown] you are accidently {doing something wrong}. Help me improve my prompt engineering skills and tell me how could I have prompted you better and give me a specific example?
Cancel