dipsmom commited on
Commit
0f072f0
1 Parent(s): 028a38d

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +41 -0
  2. utils.py +39 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import utils as utils
3
+
4
+ import streamlit as st
5
+ from io import StringIO
6
+ from datetime import datetime, date
7
+
8
+ def dataframe_to_csv_download(dataframe):
9
+ # Convert the DataFrame to a CSV string
10
+ csv = dataframe.to_csv(index=False)
11
+ csv_bytes = csv.encode('utf-8')
12
+
13
+ # Create a buffer to hold the CSV string in bytes
14
+ buf = StringIO()
15
+ buf.write(csv)
16
+ buf.seek(0)
17
+
18
+ today = datetime.now().strftime("%Y-%m-%d %H:%M")
19
+
20
+ # Create a download button in the Streamlit app
21
+ st.download_button(
22
+ label="Download CSV File",
23
+ data=csv_bytes,
24
+ file_name=f"ScrappedData_{today}.csv",
25
+ mime="text/csv",
26
+ )
27
+
28
+
29
+
30
+ if __name__=='__main__':
31
+ st.title('LinkedIn Job Scraper')
32
+ st.write('This app scrapes LinkedIn for job listings.')
33
+ url = st.text_area("Enter the url here..")
34
+
35
+ if st.button("Get Records") and url:
36
+ with st.spinner("Scrapping the given URL"):
37
+ scrap_df = utils.scrap_data(url)
38
+ st.dataframe(scrap_df)
39
+ dataframe_to_csv_download(scrap_df)
40
+
41
+ st.write('')
utils.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import utils as utils
2
+ import streamlit as st
3
+ from io import StringIO
4
+ from datetime import datetime, date
5
+
6
+ def dataframe_to_csv_download(dataframe):
7
+ # Convert the DataFrame to a CSV string
8
+ csv = dataframe.to_csv(index=False)
9
+ csv_bytes = csv.encode('utf-8')
10
+
11
+ # Create a buffer to hold the CSV string in bytes
12
+ buf = StringIO()
13
+ buf.write(csv)
14
+ buf.seek(0)
15
+
16
+ today = datetime.now().strftime("%Y-%m-%d %H:%M")
17
+
18
+ # Create a download button in the Streamlit app
19
+ st.download_button(
20
+ label="Download CSV File",
21
+ data=csv_bytes,
22
+ file_name=f"ScrappedData_{today}.csv",
23
+ mime="text/csv",
24
+ )
25
+
26
+
27
+
28
+ if __name__=='__main__':
29
+ st.title('LinkedIn Job Scraper')
30
+ st.write('This app scrapes LinkedIn for job listings.')
31
+ url = st.text_area("Enter the url here..")
32
+
33
+ if st.button("Get Records") and url:
34
+ with st.spinner("Scrapping the given URL"):
35
+ scrap_df = utils.scrap_data(url)
36
+ st.dataframe(scrap_df)
37
+ dataframe_to_csv_download(scrap_df)
38
+
39
+ st.write('')