New: AI SEO tools- OpenGraph Tags generation, blog from pdf
This commit is contained in:
119
lib/ai_seo_tools/README.md
Normal file
119
lib/ai_seo_tools/README.md
Normal file
@@ -0,0 +1,119 @@
|
||||
### Boost Your SEO Strategy with Alwrity's Advanced AI Tools
|
||||
|
||||
A lot of On-page SEO tools are present for now. We are integrating APIs for Analytics which will better the content quality & hence SEO.
|
||||
Website audit, rank tracking, SEO suggestions, keyword research, link building and concepts EEAT will all be incorporated.
|
||||
Checkout the TBD file in this directory for future enhancements.
|
||||
|
||||
Here's an in-depth look at how each of these tools can enhance your SEO efforts:
|
||||
|
||||
---
|
||||
|
||||
### 1. **SEO Analyzer** WIP
|
||||
|
||||
---
|
||||
|
||||
### 2. **Meta Description Generator**
|
||||
**File:** `meta_desc_generator.py`
|
||||
|
||||
Meta descriptions play a crucial role in attracting clicks from search engine results pages (SERPs). Alwrity's Meta Description Generator crafts compelling, keyword-optimized meta descriptions tailored to your content. This tool ensures that your meta descriptions not only reflect the essence of your content but also entice users to click.
|
||||
|
||||
**Key Features:**
|
||||
- Generates SEO-friendly meta descriptions
|
||||
- Tailors descriptions to target keywords
|
||||
- Enhances click-through rates (CTR) from SERPs
|
||||
|
||||
---
|
||||
|
||||
### 3. **Content Title Generator**
|
||||
**File:** `content_title_generator.py`
|
||||
|
||||
Your content's title is the first impression you make on both search engines and users. The Content Title Generator by Alwrity creates attention-grabbing, keyword-optimized titles that resonate with your audience and improve your content's searchability.
|
||||
|
||||
**Key Features:**
|
||||
- Generates optimized titles based on your keywords
|
||||
- Ensures relevance and engagement
|
||||
- Improves content visibility on search engines
|
||||
|
||||
---
|
||||
|
||||
### 4. **OpenGraph Generator**
|
||||
**File:** `opengraph_generator.py`
|
||||
|
||||
OpenGraph tags are essential for social media optimization, allowing your content to be displayed beautifully when shared on platforms like Facebook and LinkedIn. The OpenGraph Generator ensures that your content is always presented in the best light, driving more traffic from social media channels.
|
||||
|
||||
**Key Features:**
|
||||
- Automatically generates OpenGraph tags
|
||||
- Optimizes content for social sharing
|
||||
- Enhances visual appeal and clickability on social platforms
|
||||
|
||||
---
|
||||
|
||||
### 5. **Image Alt Text Generator**
|
||||
**File:** `image_alt_text_generator.py`
|
||||
|
||||
Alt text is not just for accessibility; it's also a critical SEO factor that helps search engines understand the content of your images. The Image Alt Text Generator uses AI to create descriptive, keyword-rich alt texts that improve your image SEO.
|
||||
|
||||
**Key Features:**
|
||||
- Generates SEO-friendly alt text for images
|
||||
- Enhances image discoverability in search engines
|
||||
- Improves website accessibility
|
||||
|
||||
---
|
||||
|
||||
### 6. **OpenGraph Image Generator**
|
||||
**File:** `opengraph_image_generate.py`
|
||||
|
||||
A picture is worth a thousand words, especially on social media. The OpenGraph Image Generator creates custom images optimized for OpenGraph tags, ensuring that your content is visually appealing and engaging when shared across platforms.
|
||||
|
||||
**Key Features:**
|
||||
- Generates custom images for OpenGraph tags
|
||||
- Ensures optimal size and resolution for social media
|
||||
- Enhances brand visibility and engagement
|
||||
|
||||
---
|
||||
|
||||
### 7. **SEO Analysis** WIP
|
||||
|
||||
---
|
||||
|
||||
### 8. **SEO Structured Data Generator**
|
||||
**File:** `seo_structured_data.py`
|
||||
|
||||
Structured data is essential for modern SEO, enabling search engines to better understand your content and potentially display rich snippets. The SEO Structured Data Generator by Alwrity automates the creation of structured data, improving your chances of appearing in featured snippets.
|
||||
|
||||
**Key Features:**
|
||||
- Automatically generates structured data
|
||||
- Improves chances of rich snippet placement
|
||||
- Enhances content discoverability
|
||||
|
||||
---
|
||||
|
||||
### 9. **Twitter Tags Generator**
|
||||
**File:** `twitter_tags_generator.py`
|
||||
|
||||
Optimize your content for Twitter with Alwrity's Twitter Tags Generator. This tool creates the perfect set of tags to ensure your content gets noticed, shared, and engaged with on Twitter.
|
||||
|
||||
**Key Features:**
|
||||
- Generates optimized Twitter tags
|
||||
- Enhances content visibility on Twitter
|
||||
- Increases engagement and shares
|
||||
|
||||
---
|
||||
|
||||
### Action Plan: How to Leverage Alwrity’s AI SEO Tools
|
||||
|
||||
1. **Audit Your Website:** Start with the SEO Analyzer to identify areas of improvement and optimize your on-page and technical SEO.
|
||||
|
||||
2. **Optimize Meta Descriptions and Titles:** Use the Meta Description Generator and Content Title Generator to craft compelling and search-friendly metadata.
|
||||
|
||||
3. **Enhance Social Media Presence:** Implement the OpenGraph Generator and OpenGraph Image Generator to ensure your content shines on social media platforms.
|
||||
|
||||
4. **Improve Image SEO:** Generate descriptive alt texts for all your images using the Image Alt Text Generator.
|
||||
|
||||
5. **Analyze and Refine:** Regularly use the SEO Analysis tool to monitor your progress and refine your strategies.
|
||||
|
||||
6. **Implement Structured Data:** Automate the creation of structured data with the SEO Structured Data Generator to boost your chances of appearing in rich snippets.
|
||||
|
||||
7. **Boost Twitter Engagement:** Optimize your Twitter content with the Twitter Tags Generator to increase visibility and engagement.
|
||||
|
||||
By integrating these AI-powered tools into your SEO strategy, you can drive significant organic growth, improve your search rankings, and stay ahead of the competition.
|
||||
@@ -5,3 +5,9 @@ https://developers.google.com/speed/docs/insights/v5/get-started
|
||||
https://developers.google.com/search/apis/indexing-api/v3/prereqs
|
||||
https://developer.chrome.com/docs/lighthouse/overview/#cli
|
||||
|
||||
APIs
|
||||
https://docs.ayrshare.com/
|
||||
https://github.com/dataforseo/PythonClient
|
||||
https://mysiteauditor.com/api
|
||||
|
||||
https://github.com/searchsolved/search-solved-public-seo/blob/main/keyword-research/low-competition-keyword-finder-serp-api/low_competition_finder_serp_api.py
|
||||
|
||||
2
lib/ai_seo_tools/opengraph_image_generate.py
Normal file
2
lib/ai_seo_tools/opengraph_image_generate.py
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
ogImage TBD
|
||||
@@ -1,116 +0,0 @@
|
||||
import streamlit as st
|
||||
import openai
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
import os
|
||||
|
||||
from ..ai_web_researcher.firecrawl_web_crawler import scrape_url
|
||||
from ..gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
|
||||
|
||||
# Placeholder function for web scraping the URL (to be replaced with your mechanism)
|
||||
def scrape_webpage(url):
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status() # Raise an exception for bad status codes
|
||||
soup = BeautifulSoup(response.content, 'html.parser')
|
||||
|
||||
# Extract the title
|
||||
title = soup.find('title').text.strip() if soup.find('title') else None
|
||||
|
||||
# Extract the description
|
||||
description = soup.find('meta', attrs={'name': 'description'})['content'] if soup.find('meta', attrs={'name': 'description'}) else None
|
||||
|
||||
# Extract the image URL
|
||||
image_url = soup.find('meta', attrs={'property': 'og:image'})['content'] if soup.find('meta', attrs={'property': 'og:image'}) else None
|
||||
|
||||
return title, description, image_url
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
st.error(f"An error occurred while scraping the webpage: {e}")
|
||||
return None, None, None
|
||||
|
||||
# Function to generate OpenGraph meta tags
|
||||
def generate_opengraph_meta_tags(url, html_content=None, title=None, description=None, image_url=None):
|
||||
ai_prompt = f"""
|
||||
Generate OpenGraph meta tags for a Twitter Card for the following webpage: {url}
|
||||
|
||||
Here is the HTML content of the page:
|
||||
```html
|
||||
{html_content}
|
||||
```
|
||||
|
||||
Optional Customizations:
|
||||
* Title: {title if title else "Infer from the page content"}
|
||||
* Description: {description if description else "Infer from the page content"}
|
||||
* Image URL: {image_url if image_url else "Infer from the page content"}
|
||||
|
||||
Best practices:
|
||||
- Title: Should be concise and informative.
|
||||
- Description: Provide a brief summary of the content.
|
||||
- Image URL: Use a high-quality image.
|
||||
- URL: Ensure the URL is correct.
|
||||
- Type: Specify the content type (e.g., article, website).
|
||||
- Site Name: Provide the name of the site.
|
||||
|
||||
Output the generated OpenGraph meta tags as a series of HTML meta tags in the following format:
|
||||
|
||||
<meta property="og:title" content="Extracted or provided title" />
|
||||
<meta property="og:description" content="Extracted or provided description" />
|
||||
<meta property="og:image" content="Extracted or provided image URL" />
|
||||
<meta property="og:url" content="{url}" />
|
||||
<meta property="og:type" content="Infer from the URL" />
|
||||
<meta property="og:site_name" content="Extract site name from the URL" />
|
||||
"""
|
||||
|
||||
response = openai.Completion.create(
|
||||
engine="text-davinci-003",
|
||||
prompt=ai_prompt,
|
||||
max_tokens=150
|
||||
)
|
||||
|
||||
return response.choices[0].text.strip()
|
||||
|
||||
# Function to display the Streamlit UI
|
||||
def display_ui():
|
||||
st.title('OpenGraph Meta Tags Generator for Twitter 🐦')
|
||||
st.write('Generate OpenGraph meta tags for Twitter cards with ease. Just provide a URL and let our tool do the rest!')
|
||||
|
||||
# User inputs
|
||||
url = st.text_input('Content URL', help="🔗 Paste the URL of the page you want to share on Twitter.", placeholder="e.g., https://example.com")
|
||||
title = st.text_input('Title (optional)', help="📝 Optionally, provide a custom title for your Twitter card.", placeholder="e.g., Amazing Blog Post")
|
||||
description = st.text_area('Description (optional)', help="✍️ Optionally, provide a custom description for your Twitter card.", placeholder="e.g., This blog post covers...")
|
||||
image_url = st.text_input('Image URL (optional)', help="📸 Optionally, provide a URL to an image for your Twitter card.", placeholder="e.g., https://example.com/image.jpg")
|
||||
|
||||
if st.button('Generate Meta Tags'):
|
||||
if url:
|
||||
# Scrape the webpage for missing information if not provided
|
||||
if not title or not description or not image_url:
|
||||
scraped_title, scraped_description, scraped_image_url = scrape_webpage(url)
|
||||
title = title or scraped_title
|
||||
description = description or scraped_description
|
||||
image_url = image_url or scraped_image_url
|
||||
|
||||
# Fetch HTML content
|
||||
html_content = requests.get(url).text
|
||||
|
||||
# Generate OpenGraph meta tags
|
||||
meta_tags = generate_opengraph_meta_tags(url, html_content=html_content, title=title, description=description, image_url=image_url)
|
||||
|
||||
st.subheader('Generated OpenGraph Meta Tags')
|
||||
st.code(meta_tags, language='html')
|
||||
else:
|
||||
st.error('Please provide a content URL.')
|
||||
|
||||
# Instructions and preview
|
||||
st.write('### Instructions')
|
||||
st.write('1. Enter the URL of the content you want to share on Twitter.')
|
||||
st.write('2. Optionally, provide a custom title, description, and image URL.')
|
||||
st.write('3. Click "Generate Meta Tags" to see the generated OpenGraph meta tags.')
|
||||
|
||||
st.write('### Preview')
|
||||
st.write('A preview of how the Twitter card will look with the generated meta tags will be shown here (Feature to be implemented).')
|
||||
|
||||
# Run the Streamlit UI
|
||||
if __name__ == '__main__':
|
||||
display_ui()
|
||||
98
lib/ai_seo_tools/twitter_tags_generator.py
Normal file
98
lib/ai_seo_tools/twitter_tags_generator.py
Normal file
@@ -0,0 +1,98 @@
|
||||
import streamlit as st
|
||||
import openai
|
||||
import os
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
|
||||
from ..gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
|
||||
|
||||
def scrape_url_content(url):
|
||||
"""
|
||||
Scrapes the content from the provided URL.
|
||||
|
||||
Args:
|
||||
url (str): The URL to scrape content from.
|
||||
|
||||
Returns:
|
||||
str: The extracted text content from the webpage.
|
||||
"""
|
||||
# FIXME: Use firecrawl metadata option for this.
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
soup = BeautifulSoup(response.content, 'html.parser')
|
||||
text = ' '.join([p.text for p in soup.find_all('p')])
|
||||
return text
|
||||
except requests.exceptions.RequestException as e:
|
||||
st.error(f"Error fetching the URL content: {e}")
|
||||
return ""
|
||||
except Exception as e:
|
||||
st.error(f"Error parsing the HTML content: {e}")
|
||||
return ""
|
||||
|
||||
def generate_twitter_tags(topic, scraped_content=""):
|
||||
"""
|
||||
Generates a list of relevant Twitter hashtags based on the topic and optional scraped content.
|
||||
|
||||
Args:
|
||||
topic (str): The main topic or key phrase.
|
||||
scraped_content (str): Optional scraped content to add more context.
|
||||
|
||||
Returns:
|
||||
str: A list of Twitter hashtags as a string.
|
||||
"""
|
||||
prompt = f"Generate a list of highly relevant and trending Twitter hashtags based on the topic '{topic}'"
|
||||
|
||||
if scraped_content:
|
||||
prompt += f" and the following content: {scraped_content[:700]}..." # Limit content to keep prompt manageable.
|
||||
|
||||
prompt += " Make sure the hashtags are popular and relevant to the topic. Follow Latest best practices for twitter tags."
|
||||
|
||||
try:
|
||||
response = llm_text_gen(prompt)
|
||||
return response
|
||||
except Exception as err:
|
||||
st.error(f"Failed to generate Open Graph tags: {err}")
|
||||
return None
|
||||
|
||||
|
||||
def display_app():
|
||||
"""
|
||||
Displays the Streamlit app UI and handles user interactions.
|
||||
"""
|
||||
st.title("AI Twitter Tag Generator")
|
||||
|
||||
st.write(
|
||||
"Generate trending and highly relevant Twitter tags with minimal input. "
|
||||
"Optionally, provide a URL to make the tags even more targeted."
|
||||
)
|
||||
|
||||
# User Inputs
|
||||
topic = st.text_input(
|
||||
"Enter the topic or key phrase for Twitter tags",
|
||||
placeholder="e.g., AI in marketing"
|
||||
)
|
||||
|
||||
url = st.text_input(
|
||||
"Optional: Enter a URL to scrape for more targeted tags",
|
||||
placeholder="e.g., https://example.com/article"
|
||||
)
|
||||
|
||||
if topic:
|
||||
if url:
|
||||
with st.spinner("Scraping content from the provided URL..."):
|
||||
scraped_content = scrape_url_content(url)
|
||||
if not scraped_content:
|
||||
st.info("No content could be extracted from the provided URL.")
|
||||
else:
|
||||
scraped_content = ""
|
||||
|
||||
if st.button("Generate Twitter Tags"):
|
||||
with st.spinner("Generating Twitter tags..."):
|
||||
tags = generate_twitter_tags(topic, scraped_content)
|
||||
if tags:
|
||||
st.success("Twitter tags generated successfully!")
|
||||
st.write(tags)
|
||||
else:
|
||||
st.info("Please enter a topic or key phrase to generate Twitter tags.")
|
||||
2
lib/ai_web_researcher/TBD
Normal file
2
lib/ai_web_researcher/TBD
Normal file
@@ -0,0 +1,2 @@
|
||||
1). Replace Firecrawl with scrapy or crawlee : https://crawlee.dev/python/docs/introduction
|
||||
|
||||
Reference in New Issue
Block a user