Update app.py
Browse files
app.py
CHANGED
@@ -42,26 +42,8 @@ def clean_bookmarks(html_content):
|
|
42 |
cleaned_html += '</body></html>'
|
43 |
|
44 |
return cleaned_html, cleaned_markdown
|
45 |
-
|
46 |
-
|
47 |
-
st.title('Bookmark File Cleaner')
|
48 |
-
|
49 |
-
uploaded_file = st.file_uploader('Choose an HTML bookmark file', type=['html'])
|
50 |
-
|
51 |
-
if uploaded_file is not None:
|
52 |
-
html_content = uploaded_file.read().decode('utf-8')
|
53 |
-
cleaned_html, cleaned_markdown = clean_bookmarks(html_content)
|
54 |
-
|
55 |
-
st.subheader('Cleaned Bookmarks')
|
56 |
-
st.text_area('Output HTML', value=cleaned_html, height=400)
|
57 |
-
st.text_area('Output Markdown', value=cleaned_markdown, height=400)
|
58 |
-
|
59 |
-
output_file = 'cleaned_bookmarks.html'
|
60 |
-
with open(output_file, 'w') as f:
|
61 |
-
f.write(cleaned_html)
|
62 |
-
|
63 |
-
st.download_button('Download Cleaned Bookmarks', cleaned_html, file_name=output_file)
|
64 |
-
|
65 |
instructions = '''
|
66 |
To export your Google Chrome bookmarks, including those on the bookmark bar, and curate the list, follow these steps:
|
67 |
**Export bookmarks:**
|
@@ -85,5 +67,29 @@ def main():
|
|
85 |
'''
|
86 |
st.markdown(instructions)
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
if __name__ == '__main__':
|
89 |
main()
|
|
|
42 |
cleaned_html += '</body></html>'
|
43 |
|
44 |
return cleaned_html, cleaned_markdown
|
45 |
+
def Instructions():
|
46 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
instructions = '''
|
48 |
To export your Google Chrome bookmarks, including those on the bookmark bar, and curate the list, follow these steps:
|
49 |
**Export bookmarks:**
|
|
|
67 |
'''
|
68 |
st.markdown(instructions)
|
69 |
|
70 |
+
|
71 |
+
def main():
|
72 |
+
st.title('Bookmark File Cleaner')
|
73 |
+
Instructions()
|
74 |
+
|
75 |
+
uploaded_file = st.file_uploader('Choose an HTML bookmark file', type=['html'])
|
76 |
+
|
77 |
+
if uploaded_file is not None:
|
78 |
+
html_content = uploaded_file.read().decode('utf-8')
|
79 |
+
cleaned_html, cleaned_markdown = clean_bookmarks(html_content)
|
80 |
+
|
81 |
+
st.subheader('Cleaned Bookmarks')
|
82 |
+
st.text_area('Output HTML', value=cleaned_html, height=400)
|
83 |
+
st.text_area('Output Markdown', value=cleaned_markdown, height=400)
|
84 |
+
|
85 |
+
output_file = 'cleaned_bookmarks.html'
|
86 |
+
with open(output_file, 'w') as f:
|
87 |
+
f.write(cleaned_html)
|
88 |
+
|
89 |
+
st.download_button('Download Cleaned Bookmarks', cleaned_html, file_name=output_file)
|
90 |
+
|
91 |
+
st.markdown(cleaned_markdown)
|
92 |
+
|
93 |
+
|
94 |
if __name__ == '__main__':
|
95 |
main()
|