remove emojies from posting reddit and others
This commit is contained in:
@@ -222,6 +222,7 @@ def curate_from_google_trends(geo_list=['US']):
|
|||||||
f"Generate exactly {num_paragraphs} paragraphs. "
|
f"Generate exactly {num_paragraphs} paragraphs. "
|
||||||
f"Do not mention Google Trends, Google, or include any links. "
|
f"Do not mention Google Trends, Google, or include any links. "
|
||||||
f"Summarize as a standalone food industry trend, focusing on '{title}' and its context."
|
f"Summarize as a standalone food industry trend, focusing on '{title}' and its context."
|
||||||
|
"Do not include emojis in the summary."
|
||||||
)
|
)
|
||||||
final_summary = summarize_with_gpt4o(
|
final_summary = summarize_with_gpt4o(
|
||||||
scoring_content,
|
scoring_content,
|
||||||
|
|||||||
@@ -140,8 +140,8 @@ def is_interesting_reddit(title, summary, upvotes, comment_count, top_comments):
|
|||||||
def get_top_comments(post_url, reddit, limit=3):
|
def get_top_comments(post_url, reddit, limit=3):
|
||||||
try:
|
try:
|
||||||
submission = reddit.submission(url=post_url)
|
submission = reddit.submission(url=post_url)
|
||||||
|
submission.comment_sort = 'top' # Move this line up
|
||||||
submission.comments.replace_more(limit=0)
|
submission.comments.replace_more(limit=0)
|
||||||
submission.comment_sort = 'top'
|
|
||||||
top_comments = [comment.body for comment in submission.comments[:limit] if not comment.body.startswith('[deleted]')]
|
top_comments = [comment.body for comment in submission.comments[:limit] if not comment.body.startswith('[deleted]')]
|
||||||
logging.info(f"Fetched {len(top_comments)} top comments for {post_url}")
|
logging.info(f"Fetched {len(top_comments)} top comments for {post_url}")
|
||||||
return top_comments
|
return top_comments
|
||||||
@@ -251,7 +251,8 @@ def curate_from_reddit():
|
|||||||
f"FOCUS: Summarize ONLY the provided content, explicitly mentioning '{title}' and sticking to its specific topic and details. "
|
f"FOCUS: Summarize ONLY the provided content, explicitly mentioning '{title}' and sticking to its specific topic and details. "
|
||||||
"Incorporate relevant insights from these top comments if available: {', '.join(top_comments) if top_comments else 'None'}. "
|
"Incorporate relevant insights from these top comments if available: {', '.join(top_comments) if top_comments else 'None'}. "
|
||||||
"Do NOT introduce unrelated concepts unless in the content or comments. "
|
"Do NOT introduce unrelated concepts unless in the content or comments. "
|
||||||
"If brief, expand on the core idea with relevant context about its appeal or significance."
|
"If brief, expand on the core idea with relevant context about its appeal or significance. "
|
||||||
|
"Do not include emojis in the summary."
|
||||||
)
|
)
|
||||||
content_to_summarize = f"{title}\n\n{summary}" # Use cleaned title
|
content_to_summarize = f"{title}\n\n{summary}" # Use cleaned title
|
||||||
if top_comments:
|
if top_comments:
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ def curate_from_rss():
|
|||||||
f"Generate exactly {num_paragraphs} paragraphs. "
|
f"Generate exactly {num_paragraphs} paragraphs. "
|
||||||
f"FOCUS: Summarize ONLY the provided content, explicitly mentioning '{title}' and sticking to its specific topic and details. "
|
f"FOCUS: Summarize ONLY the provided content, explicitly mentioning '{title}' and sticking to its specific topic and details. "
|
||||||
f"Do NOT introduce unrelated concepts. Expand on the core idea with relevant context about its appeal or significance."
|
f"Do NOT introduce unrelated concepts. Expand on the core idea with relevant context about its appeal or significance."
|
||||||
|
"Do not include emojis in the summary."
|
||||||
)
|
)
|
||||||
content_to_summarize = scoring_content
|
content_to_summarize = scoring_content
|
||||||
final_summary = summarize_with_gpt4o(
|
final_summary = summarize_with_gpt4o(
|
||||||
|
|||||||
+6
-6
@@ -108,37 +108,37 @@ SUMMARY_PERSONA_PROMPTS = {
|
|||||||
"You’re a commanding food editor with a borderless view. Summarize this article in a polished, decisive tone, like shaping a premier food mag, but with a casual twist—think bold vibes like 'This is unreal!'. "
|
"You’re a commanding food editor with a borderless view. Summarize this article in a polished, decisive tone, like shaping a premier food mag, but with a casual twist—think bold vibes like 'This is unreal!'. "
|
||||||
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
||||||
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
||||||
"Add a bold take and end with a clickbait-y question like Neil Patel would do to boost engagement!"
|
"Add a bold take and end with a clickbait-y question like Neil Patel would do to boost engagement! Do not include emojis in the summary."
|
||||||
),
|
),
|
||||||
"Foodie Critic": (
|
"Foodie Critic": (
|
||||||
"You’re a seasoned foodie reviewer with a sharp eye. Summarize this article in a pro yet lively tone, like a top food mag with a playful edge—think 'This bangs!'. "
|
"You’re a seasoned foodie reviewer with a sharp eye. Summarize this article in a pro yet lively tone, like a top food mag with a playful edge—think 'This bangs!'. "
|
||||||
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
||||||
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
||||||
"Add a subtle opinion and end with a clickbait-y question like Neil Patel would do to boost engagement!"
|
"Add a subtle opinion and end with a clickbait-y question like Neil Patel would do to boost engagement! Do not include emojis in the summary."
|
||||||
),
|
),
|
||||||
"Trend Scout": (
|
"Trend Scout": (
|
||||||
"You’re a forward-thinking editor obsessed with trends. Summarize this article in an enthusiastic voice, like 'This is the future, fam!'. "
|
"You’re a forward-thinking editor obsessed with trends. Summarize this article in an enthusiastic voice, like 'This is the future, fam!'. "
|
||||||
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
||||||
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
||||||
"Predict what’s next and end with a clickbait-y question like Neil Patel would do to boost engagement!"
|
"Predict what’s next and end with a clickbait-y question like Neil Patel would do to boost engagement! Do not include emojis in the summary."
|
||||||
),
|
),
|
||||||
"Culture Connoisseur": (
|
"Culture Connoisseur": (
|
||||||
"You’re a cultured food writer who loves storytelling. Summarize this article in a warm, reflective tone with a kick, like 'This feels different, right?'. "
|
"You’re a cultured food writer who loves storytelling. Summarize this article in a warm, reflective tone with a kick, like 'This feels different, right?'. "
|
||||||
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
||||||
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
||||||
"Add a thoughtful observation and end with a clickbait-y question like Neil Patel would do to boost engagement!"
|
"Add a thoughtful observation and end with a clickbait-y question like Neil Patel would do to boost engagement! Do not include emojis in the summary."
|
||||||
),
|
),
|
||||||
"African-American Soul Food Sage": (
|
"African-American Soul Food Sage": (
|
||||||
"You’re a vibrant storyteller rooted in African-American culinary heritage. Summarize this article in a soulful tone, like 'This got that heat, y’all!'. "
|
"You’re a vibrant storyteller rooted in African-American culinary heritage. Summarize this article in a soulful tone, like 'This got that heat, y’all!'. "
|
||||||
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
||||||
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
||||||
"Add a heritage twist and end with a clickbait-y question like Neil Patel would do to boost engagement!"
|
"Add a heritage twist and end with a clickbait-y question like Neil Patel would do to boost engagement! Do not include emojis in the summary."
|
||||||
),
|
),
|
||||||
"Global Street Food Nomad": (
|
"Global Street Food Nomad": (
|
||||||
"You’re an adventurous explorer of global street food. Summarize this article in a bold, gritty tone with a spin, like 'This is straight fire!'. "
|
"You’re an adventurous explorer of global street food. Summarize this article in a bold, gritty tone with a spin, like 'This is straight fire!'. "
|
||||||
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
"Explore a wide range of food-related topics, skip recipes. Generate exactly {num_paragraphs} paragraphs, 60-80 words each, full thoughts, with a single \n break. "
|
||||||
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
"Write naturally without mentioning the source name or URL directly in the text, with a slight Upworthy/Buzzfeed flair style. "
|
||||||
"Drop a street-level insight and end with a clickbait-y question like Neil Patel would do to boost engagement!"
|
"Drop a street-level insight and end with a clickbait-y question like Neil Patel would do to boost engagement! Do not include emojis in the summary."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -812,6 +812,7 @@ def get_flickr_image_via_ddg(search_query, relevance_keywords):
|
|||||||
response = requests.get(page_url, headers=headers, timeout=10)
|
response = requests.get(page_url, headers=headers, timeout=10)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
soup = BeautifulSoup(response.content, 'html.parser')
|
soup = BeautifulSoup(response.content, 'html.parser')
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
tags_elem = soup.find_all('a', class_='tag')
|
tags_elem = soup.find_all('a', class_='tag')
|
||||||
tags = [tag.text.strip().lower() for tag in tags_elem] if tags_elem else []
|
tags = [tag.text.strip().lower() for tag in tags_elem] if tags_elem else []
|
||||||
|
|||||||
Reference in New Issue
Block a user