From 17eaa26ec8a1cfe606d33b647d92c24da355c567 Mon Sep 17 00:00:00 2001 From: "ajaysi (aider)" Date: Tue, 17 Sep 2024 12:01:52 +0530 Subject: [PATCH] feat: enhance backlink opportunity data with website metadata and context --- lib/ai_marketing_tools/ai_backlinking.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/ai_marketing_tools/ai_backlinking.py b/lib/ai_marketing_tools/ai_backlinking.py index 0d748533..72aa35e2 100644 --- a/lib/ai_marketing_tools/ai_backlinking.py +++ b/lib/ai_marketing_tools/ai_backlinking.py @@ -179,9 +179,25 @@ def find_backlink_opportunities(keyword): # Placeholder for a function to search and get URLs urls = search_for_urls(query) for url in urls: - result = scrape_website(url) - if result: - results.append(result) + website_data = scrape_website(url) + if website_data: + contact_info = extract_contact_info(url) + detailed_result = { + "url": url, + "metadata": { + "title": website_data.get("metadata", {}).get("title", ""), + "description": website_data.get("metadata", {}).get("description", ""), + "keywords": website_data.get("metadata", {}).get("keywords", []), + "author": website_data.get("metadata", {}).get("author", ""), + }, + "content_summary": website_data.get("content_summary", ""), + "contact_info": contact_info, + "backlink_opportunity": { + "query": query, + "context": "Guest post opportunity" + } + } + results.append(detailed_result) return results