Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 61/ShubhamAshish/URLShortner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import streamlit as st
import pyperclip
import pyshorteners



st.title("URL Shortner")
st.write("Enter the URL to shorten")
url = st.text_input("URL")
if st.button("Shorten"):
shortener = pyshorteners.Shortener()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote one from scratch the other day, it makes sense to use a library, nice. I would put any code in functions for easier re-use.

x = shortener.tinyurl.short(url)
st.write(x)
pyperclip.copy(x)
st.success('Copied to clipboard')
3 changes: 3 additions & 0 deletions 61/ShubhamAshish/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
streamlit
pyperclip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this package, using it for pybites-carbon to make a carbon image from code on clipboard. Next time you could pin the requirements.

pyshorteners