SnapSearch: Simplifying Social Media Content Search

Problems Statement
Have you ever saved a YouTube Short or an Instagram reel packed with valuable information, only to lose it when you needed it the most? It happens to the best of us. Even when it comes to YouTube tutorials, finding them again can be a nightmare due to the often unreliable search functions on social media platforms.
Solution
That's why I created SnapSearch using Exa and Streamlit that allows you to search for any type of content across all social media platforms. Say goodbye to lost videos and hello to easy access to all your needed content! Discover how our powerful search tool can simplify your digital life.
Technologies Used
Exa - Exa is a knowledge API for AI and developers. Exa finds the exact content you're looking for on the web using embeddings-based search. Exa has three core functionalities, surfaced through our API endpoints (Search for pages, Get contents from pages, Find similar pages).
Streamlit- Streamlit is an open-source Python framework for data scientists and AI/ML engineers to deliver dynamic data apps with only a few lines of code. Build and deploy powerful data apps in minutes.
Prerequisites
Before creating this app, ensure you have the following dependencies in your system:
Code Setup
First create a virtual environment by running this command in your terminal -
python -m venv environment_name
to run your python script in your local system.After that activate the virtual environment by running this command in your terminal -
environment_name\Scripts\activate
.Install the following packages by using this command
pip install package_name
os
streamlit
exa_py
dotenv
create a
.env
file to store the Exa API Key
Building the App
Imports
import os
import streamlit as st
from exa_py import Exa
from dotenv import load_dotenv
Setting up the Environment Variables and API Key
# Load environment variables
load_dotenv()
# Initialize Exa API
exa_api_key = os.getenv('EXA_API')
if exa_api_key is None:
st.error('EXA_API key not found. Please set it in the .env file.')
else:
exa = Exa(api_key=exa_api_key)
Creating the Streamlit interface
st.title('SnapSearch β¦.')
st.subheader('Search any content with SnapSearch ')
domain = st.text_input('Enter the URL of the Social Media platform where you want to search: (e.g., https://medium.com/, https://www.reddit.com/)')
query = st.text_input('Search your content here: (e.g., Resume building tips by coding content creators, WEB3 creators)')
Exa Search code
if st.button('Search'):
if not domain:
st.warning('Please enter a URL for the Social Media platform.')
elif not query:
st.warning('Please enter a content.')
else:
response = exa.search(
query,
num_results=10,
type='keyword',
include_domains=[domain],
)
st.subheader(f'Search results for: {query}')
if response.results:
for result in response.results:
st.write(f"**Title:** {result.title}")
st.write(f"**URL:** {result.url}")
st.write("---")
else:
st.write('No results found.')
Complete code
import os
import streamlit as st
from exa_py import Exa
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Initialize Exa API
exa_api_key = os.getenv('EXA_API')
if exa_api_key is None:
st.error('EXA_API key not found. Please set it in the .env file.')
else:
exa = Exa(api_key=exa_api_key)
# Streamlit interface
st.title('SnapSearch β¦.')
st.subheader('Search any content with SnapSearch ')
domain = st.text_input('Enter the URL of the Social Media platform where you want to search: (e.g., https://medium.com/, https://www.reddit.com/)')
query = st.text_input('Search your content here: (e.g., Resume building tips by coding content creators, WEB3 creators)')
if st.button('Search'):
if not domain:
st.warning('Please enter a URL for the Social Media platform.')
elif not query:
st.warning('Please enter a content.')
else:
response = exa.search(
query,
num_results=10,
type='keyword',
include_domains=[domain],
)
st.subheader(f'Search results for: {query}')
if response.results:
for result in response.results:
st.write(f"**Title:** {result.title}")
st.write(f"**URL:** {result.url}")
st.write("---")
else:
st.write('No results found.')
Run the App in your local system
Run the App in your local system by running this command in your terminal streamlit run app_name.py
.
Demo Video
Try it yourself
Subscribe to my newsletter
Read articles from Sayak Bhunia directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Sayak Bhunia
Sayak Bhunia
Hey ππ», I am Sayak Bhunia, a passionate developer π§βπ» and programmer from Kolkata, India. I have hands-on experience in Web Dev πΈοΈ, Cloud βοΈ, Open-Source π₯οΈ, and a little bit of WEB3. All and all I am very passionate about any concept of new technology π. I love to try out new things on my own and work on tough challenges in a scheduled timeline. Currently adapting to the generation of AIπ€.