-
Notifications
You must be signed in to change notification settings - Fork 106
ALwrity Open Graph Generator AI Tool
The opengraph_generator.py
module is designed to generate Open Graph (OG) tags, which are essential for optimizing how web pages are displayed when shared on social media platforms like Facebook and Twitter. This module leverages a text generation model to create these tags based on input hints and the content of the specified webpage.
- Generate Open Graph Tags: Automatically generate OG tags for any given URL.
- Platform Specific Tags: Customize tags for general use, Facebook, or Twitter.
- Extract Default OG Tags: Extract existing OG tags from a webpage.
- Streamlit Integration: Provides a user-friendly interface for generating and displaying OG tags.
Ensure that your web pages display optimally when shared on social media platforms by generating accurate and relevant OG tags.
Improve your site's search engine ranking and click-through rates by providing detailed and accurate metadata.
Easily manage and update OG tags for your webpage content, ensuring consistency and accuracy across all pages.
To use this module, you need the following Python packages installed:
streamlit
requests
beautifulsoup4
cloudscraper
Install the required packages using pip:
pip install streamlit requests beautifulsoup4 cloudscraper
This module is designed to be run as a Streamlit application. Below is an example code snippet to run the Open Graph Tag Generator using Streamlit:
import streamlit as st
from opengraph_generator import og_tag_generator
if __name__ == "__main__":
og_tag_generator()
Generates Open Graph tags based on the provided URL, title hint, description hint, and platform.
Parameters:
-
url
(str): The URL of the webpage. -
title_hint
(str): A hint for the title. -
description_hint
(str): A hint for the description. -
platform
(str): The platform for which to generate the tags (General, Facebook, or Twitter).
Returns:
-
str
: The generated Open Graph tags or an error message.
Extracts default Open Graph tags from the provided URL.
Parameters:
-
url
(str): The URL of the webpage.
Returns:
-
tuple
: A tuple containing the title, description, and image URL, or None in case of an error.
Main function to run the Streamlit app.
Here is an example of how to use the Streamlit app to generate Open Graph tags:
-
Run the Streamlit app:
streamlit run opengraph_generator.py
-
Open the Streamlit app in your browser.
-
Enter the URL of the webpage you want to generate Open Graph tags for.
-
Modify the existing title, description, and image URL or suggest new ones.
-
Select the platform (General, Facebook, Twitter).
-
Click "Generate Open Graph Tags" to generate the tags.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please open an issue or submit a pull request to contribute to this project.