update authors

my-fix-branch
Shane 8 months ago
parent 7dea654e1e
commit 9b1591e2e8
  1. 12
      foodie_config.py
  2. 22
      foodie_utils.py

@ -7,8 +7,8 @@ PIXABAY_API_KEY = "14836528-999c19a033d77d463113b1fb8"
AUTHORS = [
{
"url": "https://insiderfoodie.com",
"username": "oliverwilson",
"password": "rfjk xhn6 2RPy FuQ9 cGlU K8mC",
"username": "owenjohnson",
"password": "hESy E2qO grdB KiKS X6SW oM05",
"persona": "Visionary Editor",
"bio": "I oversee worldwide dining shifts, obsessed with the big picture. My edits deliver precise takes—charting the future of food with confidence."
},
@ -28,15 +28,15 @@ AUTHORS = [
},
{
"url": "https://insiderfoodie.com",
"username": "liennguyen",
"password": "Xorz sdpp T08J 8buz cCba BGzW",
"username": "trangnguyen",
"password": "A53T Nn8i CCEI HMq8 a9Ps Uhyg",
"persona": "Culture Connoisseur",
"bio": "I trace worldwide dining traditions, weaving past into present. My words uncover the soul of flavor—connecting cultures bite by bite."
},
{
"url": "https://insiderfoodie.com",
"username": "keishawashington",
"password": "PMjv bKMb FmUc bzZG ZV1f ZzpK",
"username": "keishareid",
"password": "BOGQ pjT8 rdTv JyOJ 3IjB Apww",
"persona": "African-American Soul Food Sage",
"bio": "I bring soul food’s legacy to life, blending history with modern vibes. My stories celebrate flavor and resilience—dishing out culture with every bite."
},

@ -708,11 +708,11 @@ def post_to_wp(post_data, category, link, author, image_url, original_source, im
content = "Content unavailable. Check the original source for details."
formatted_content = "\n".join(f"<p>{para}</p>" for para in content.split('\n') if para.strip())
author_id_map = {
"oliverwilson": 9,
"owenjohnson": 10,
"javiermorales": 2,
"aishapatel": 3,
"liennguyen": 4,
"keishawashington": 6,
"trangnguyen": 12,
"keishareid": 13,
"lilamoreau": 7
}
author_id = author_id_map.get(author["username"], 5)
@ -901,9 +901,9 @@ def select_best_author(summary):
messages=[
{"role": "system", "content": (
"Based on this restaurant/food industry trend summary, pick the most suitable author from: "
"oliverwilson, javiermorales, aishapatel, liennguyen, keishawashington, lilamoreau. "
"Consider their expertise: oliverwilson (global dining trends), javiermorales (food critique), "
"aishapatel (emerging food trends), liennguyen (cultural dining), keishawashington (soul food heritage), "
"owenjohnson, javiermorales, aishapatel, trangnguyen, keishareid, lilamoreau. "
"Consider their expertise: owenjohnson (global dining trends), javiermorales (food critique), "
"aishapatel (emerging food trends), trangnguyen (cultural dining), keishareid (soul food heritage), "
"lilamoreau (global street food). Return only the username."
)},
{"role": "user", "content": summary}
@ -911,12 +911,12 @@ def select_best_author(summary):
max_tokens=20
)
author = response.choices[0].message.content.strip()
valid_authors = ["oliverwilson", "javiermorales", "aishapatel", "liennguyen", "keishawashington", "lilamoreau"]
valid_authors = ["owenjohnson", "javiermorales", "aishapatel", "trangnguyen", "keishareid", "lilamoreau"]
logging.info(f"Selected author: {author}")
return author if author in valid_authors else "oliverwilson"
return author if author in valid_authors else "owenjohnson"
except Exception as e:
logging.error(f"Author selection failed: {e}")
return "oliverwilson"
return "owenjohnson"
def prepare_post_data(final_summary, original_title, context_info=""):
innovative_title = generate_title_from_summary(final_summary)
@ -948,8 +948,8 @@ def prepare_post_data(final_summary, original_title, context_info=""):
selected_username = select_best_author(final_summary)
author = next((a for a in AUTHORS if a["username"] == selected_username), None)
if not author:
logging.error(f"Author '{selected_username}' not found in AUTHORS, defaulting to oliverwilson")
author = {"username": "oliverwilson", "password": "rfjk xhn6 2RPy FuQ9 cGlU K8mC"}
logging.error(f"Author '{selected_username}' not found in AUTHORS, defaulting to owenjohnson")
author = {"username": "owenjohnson", "password": "rfjk xhn6 2RPy FuQ9 cGlU K8mC"}
category = generate_category_from_summary(final_summary)
return post_data, author, category, image_url, image_source, uploader, page_url
Loading…
Cancel
Save