remove double cta
This commit is contained in:
@@ -29,7 +29,7 @@ from foodie_utils import (
|
||||
generate_category_from_summary, post_to_wp, prepare_post_data,
|
||||
smart_image_and_filter, insert_link_naturally, get_flickr_image
|
||||
)
|
||||
from foodie_hooks import get_dynamic_hook, select_best_cta, get_viral_share_prompt # Added import
|
||||
from foodie_hooks import get_dynamic_hook, get_viral_share_prompt # Removed select_best_cta import
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
@@ -257,7 +257,7 @@ def curate_from_google_trends(geo_list=['US']):
|
||||
image_url, image_source, uploader, page_url = get_image(image_query)
|
||||
|
||||
hook = get_dynamic_hook(post_data["title"]).strip()
|
||||
cta = select_best_cta(post_data["title"], final_summary, post_url=None)
|
||||
# Removed: cta = select_best_cta(post_data["title"], final_summary, post_url=None)
|
||||
|
||||
# Generate viral share prompt
|
||||
share_prompt = get_viral_share_prompt(post_data["title"], final_summary)
|
||||
@@ -266,7 +266,7 @@ def curate_from_google_trends(geo_list=['US']):
|
||||
f'<a href="https://x.com/intent/tweet?url={{post_url}}&text={{share_text}}" target="_blank"><i class="tsi tsi-twitter"></i></a> '
|
||||
f'<a href="https://www.facebook.com/sharer/sharer.php?u={{post_url}}" target="_blank"><i class="tsi tsi-facebook"></i></a></p>'
|
||||
)
|
||||
post_data["content"] = f"{final_summary}\n\n{cta}\n\n{share_links_template}"
|
||||
post_data["content"] = f"{final_summary}\n\n{share_links_template}" # Removed cta from content
|
||||
|
||||
global is_posting
|
||||
is_posting = True
|
||||
@@ -292,8 +292,8 @@ def curate_from_google_trends(geo_list=['US']):
|
||||
share_text_encoded = quote(share_text)
|
||||
post_url_encoded = quote(post_url)
|
||||
share_links = share_links_template.format(post_url=post_url_encoded, share_text=share_text_encoded)
|
||||
cta = select_best_cta(post_data["title"], final_summary, post_url=post_url)
|
||||
post_data["content"] = f"{final_summary}\n\n{cta}\n\n{share_links}"
|
||||
# Removed: cta = select_best_cta(post_data["title"], final_summary, post_url=post_url)
|
||||
post_data["content"] = f"{final_summary}\n\n{share_links}" # Removed cta from content
|
||||
is_posting = True
|
||||
try:
|
||||
post_to_wp(
|
||||
|
||||
@@ -28,7 +28,7 @@ from foodie_utils import (
|
||||
prepare_post_data, select_best_author, smart_image_and_filter,
|
||||
get_flickr_image
|
||||
)
|
||||
from foodie_hooks import get_dynamic_hook, select_best_cta, get_viral_share_prompt # Added import
|
||||
from foodie_hooks import get_dynamic_hook, get_viral_share_prompt # Removed select_best_cta import
|
||||
|
||||
load_dotenv()
|
||||
|
||||
@@ -300,7 +300,7 @@ def curate_from_reddit():
|
||||
image_url, image_source, uploader, page_url = get_image(image_query)
|
||||
|
||||
hook = get_dynamic_hook(post_data["title"]).strip()
|
||||
cta = select_best_cta(post_data["title"], final_summary, post_url=None)
|
||||
# Removed: cta = select_best_cta(post_data["title"], final_summary, post_url=None)
|
||||
|
||||
# Generate viral share prompt
|
||||
share_prompt = get_viral_share_prompt(post_data["title"], final_summary)
|
||||
@@ -309,7 +309,7 @@ def curate_from_reddit():
|
||||
f'<a href="https://x.com/intent/tweet?url={{post_url}}&text={{share_text}}" target="_blank"><i class="tsi tsi-twitter"></i></a> '
|
||||
f'<a href="https://www.facebook.com/sharer/sharer.php?u={{post_url}}" target="_blank"><i class="tsi tsi-facebook"></i></a></p>'
|
||||
)
|
||||
post_data["content"] = f"{final_summary}\n\n{cta}\n\n{share_links_template}"
|
||||
post_data["content"] = f"{final_summary}\n\n{share_links_template}" # Removed cta from content
|
||||
|
||||
global is_posting
|
||||
is_posting = True
|
||||
@@ -335,8 +335,8 @@ def curate_from_reddit():
|
||||
share_text_encoded = quote(share_text)
|
||||
post_url_encoded = quote(post_url)
|
||||
share_links = share_links_template.format(post_url=post_url_encoded, share_text=share_text_encoded)
|
||||
cta = select_best_cta(post_data["title"], final_summary, post_url=post_url)
|
||||
post_data["content"] = f"{final_summary}\n\n{cta}\n\n{share_links}"
|
||||
# Removed: cta = select_best_cta(post_data["title"], final_summary, post_url=post_url)
|
||||
post_data["content"] = f"{final_summary}\n\n{share_links}" # Removed cta from content
|
||||
is_posting = True
|
||||
try:
|
||||
post_to_wp(
|
||||
|
||||
@@ -27,7 +27,7 @@ from foodie_utils import (
|
||||
generate_category_from_summary, post_to_wp, prepare_post_data,
|
||||
select_best_author, smart_image_and_filter, get_flickr_image
|
||||
)
|
||||
from foodie_hooks import get_dynamic_hook, select_best_cta, get_viral_share_prompt # Added import
|
||||
from foodie_hooks import get_dynamic_hook, get_viral_share_prompt # Removed select_best_cta import
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
@@ -175,7 +175,7 @@ def fetch_rss_feeds():
|
||||
continue
|
||||
logging.info(f"Filtered to {len(articles)} articles from {feed_url}")
|
||||
except Exception as e:
|
||||
logging.error(f"Failed to fetch RSS feed {feed |url}: {e}")
|
||||
logging.error(f"Failed to fetch RSS feed {feed_url}: {e}")
|
||||
continue
|
||||
|
||||
articles.sort(key=lambda x: x["pub_date"], reverse=True)
|
||||
@@ -272,7 +272,7 @@ def curate_from_rss():
|
||||
image_url, image_source, uploader, page_url = get_image(image_query)
|
||||
|
||||
hook = get_dynamic_hook(post_data["title"]).strip()
|
||||
cta = select_best_cta(post_data["title"], final_summary, post_url=None)
|
||||
# Removed: cta = select_best_cta(post_data["title"], final_summary, post_url=None)
|
||||
|
||||
# Generate viral share prompt
|
||||
share_prompt = get_viral_share_prompt(post_data["title"], final_summary)
|
||||
@@ -281,7 +281,7 @@ def curate_from_rss():
|
||||
f'<a href="https://x.com/intent/tweet?url={{post_url}}&text={{share_text}}" target="_blank"><i class="tsi tsi-twitter"></i></a> '
|
||||
f'<a href="https://www.facebook.com/sharer/sharer.php?u={{post_url}}" target="_blank"><i class="tsi tsi-facebook"></i></a></p>'
|
||||
)
|
||||
post_data["content"] = f"{final_summary}\n\n{cta}\n\n{share_links_template}"
|
||||
post_data["content"] = f"{final_summary}\n\n{share_links_template}" # Removed cta from content
|
||||
|
||||
global is_posting
|
||||
is_posting = True
|
||||
@@ -307,8 +307,8 @@ def curate_from_rss():
|
||||
share_text_encoded = quote(share_text)
|
||||
post_url_encoded = quote(post_url)
|
||||
share_links = share_links_template.format(post_url=post_url_encoded, share_text=share_text_encoded)
|
||||
cta = select_best_cta(post_data["title"], final_summary, post_url=post_url)
|
||||
post_data["content"] = f"{final_summary}\n\n{cta}\n\n{share_links}"
|
||||
# Removed: cta = select_best_cta(post_data["title"], final_summary, post_url=post_url)
|
||||
post_data["content"] = f"{final_summary}\n\n{share_links}" # Removed cta from content
|
||||
is_posting = True
|
||||
try:
|
||||
post_to_wp(
|
||||
|
||||
@@ -49,21 +49,9 @@ def get_viral_share_prompt(article_title, content):
|
||||
temperature=0.9
|
||||
)
|
||||
share_prompt = response.choices[0].message.content.strip()
|
||||
# Remove any leading or trailing quotation marks
|
||||
share_prompt = share_prompt.strip('"\'')
|
||||
logging.info(f"Generated viral share prompt: {share_prompt}")
|
||||
return share_prompt
|
||||
except Exception as e:
|
||||
logging.error(f"Viral share prompt generation failed: {e}")
|
||||
return "Love This? Share It"
|
||||
|
||||
def select_best_cta(title, content, post_url=None):
|
||||
cta_templates = [
|
||||
"Love This Foodie Find Hit That Like Button",
|
||||
"Think This Dish Is a Game Changer Show Some Love With a Like",
|
||||
"Hungry for More Foodie Insights Follow Us for the Latest Trends",
|
||||
"Dont Miss Out on Foodie Updates Follow Us Today"
|
||||
]
|
||||
|
||||
cta = random.choice(cta_templates)
|
||||
return cta
|
||||
Reference in New Issue
Block a user