mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-26 01:15:52 +03:00
[GH-ISSUE #103] AI tool generator for OpenGraph Tags #82
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AJaySi on GitHub (Aug 7, 2024).
Original GitHub issue: https://github.com/AJaySi/ALwrity/issues/103
Originally assigned to: @AJaySi on GitHub.
AI tool generator for OpenGraph Tags. This will help in SEO of the social media posts.
@AJaySi commented on GitHub (Aug 7, 2024):
Explanation:
streamlit,BeautifulSoup,requests, andspacy.st.title("Open Graph Tag Generator")- Set the title of your app.st.text_input("Enter URL:")- Create a text input field for the user to enter the URL.st.text_input("Override Title (optional):")- Create a text input field for the user to optionally override the title.st.text_area("Override Description (optional):")- Create a text area for the user to optionally override the description.st.text_input("Override Image URL (optional):")- Create a text input field for the user to optionally override the image URL.st.button("Generate Open Graph Tags")- Create a button that triggers the tag generation when clicked.if url:- Check if the user has entered a URL.response = requests.get(url)- Userequeststo get the HTML content of the URL.soup = BeautifulSoup(response.content, 'html.parser')- Parse the HTML content withBeautifulSoup.extracted_title = soup.find('title').text- Try to extract the title from the HTML.extracted_description = soup.find('meta', attrs={'name': 'description'})['content']- Try to extract the description from the HTML.extracted_image_url = soup.find('meta', attrs={'property': 'og:image'})['content']- Try to extract theog:imageURL from the HTML.except:- If any errors occur while fetching or parsing the content, set the extracted values toNone.format()to create the HTML code for the OG tags, using the provided values or the extracted values.st.code(og_tags, language='html')- Display the generated HTML code usingst.code().st.warning("Please enter a valid URL.")- Display a warning message if the user has not entered a valid URL.To run this code:
app.py.Enhancements:
st.image()to display the extracted image in a preview.This Streamlit app will give you a good starting point for building your Open Graph tag generator. Feel free to customize and extend it further.
@AJaySi commented on GitHub (Aug 14, 2024):
Committed changes.