Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,11 +24,11 @@ def visualize(url):
|
|
| 24 |
# Fetch and display the website content
|
| 25 |
with st.spinner("loading website data ..."):
|
| 26 |
# innerHTML = get_innerHTML(url)
|
| 27 |
-
html_content, xdataframe = take_webdata(url)
|
| 28 |
#st.subheader("Website title:")
|
| 29 |
if xdataframe:
|
| 30 |
#st.info(html_content)
|
| 31 |
-
|
| 32 |
# Konversi tabel HTML ke DataFrame Pandas
|
| 33 |
#df = pd.read_html(str(parse_element))[0]
|
| 34 |
#st.dataframe(df) # tampilkan tabel dengan format rapi Streamlit
|
|
@@ -59,7 +59,7 @@ def take_webdata(url):
|
|
| 59 |
soup = BeautifulSoup(html, "html.parser")
|
| 60 |
div_find = soup.find("div", id="tournament-table", class_="tournament-table-standings")
|
| 61 |
#table_find = div_find.find("table") if div_find else None
|
| 62 |
-
|
| 63 |
data = []
|
| 64 |
#for row in rows:
|
| 65 |
#rank = row.select_one(".tableCellRank")
|
|
@@ -93,7 +93,7 @@ def take_webdata(url):
|
|
| 93 |
if wd:
|
| 94 |
wd.quit()
|
| 95 |
|
| 96 |
-
return html , div_find
|
| 97 |
|
| 98 |
if __name__ == "__main__":
|
| 99 |
main()
|
|
|
|
| 24 |
# Fetch and display the website content
|
| 25 |
with st.spinner("loading website data ..."):
|
| 26 |
# innerHTML = get_innerHTML(url)
|
| 27 |
+
html_content, xdataframe, baris = take_webdata(url)
|
| 28 |
#st.subheader("Website title:")
|
| 29 |
if xdataframe:
|
| 30 |
#st.info(html_content)
|
| 31 |
+
st.code(baris, language='html')
|
| 32 |
# Konversi tabel HTML ke DataFrame Pandas
|
| 33 |
#df = pd.read_html(str(parse_element))[0]
|
| 34 |
#st.dataframe(df) # tampilkan tabel dengan format rapi Streamlit
|
|
|
|
| 59 |
soup = BeautifulSoup(html, "html.parser")
|
| 60 |
div_find = soup.find("div", id="tournament-table", class_="tournament-table-standings")
|
| 61 |
#table_find = div_find.find("table") if div_find else None
|
| 62 |
+
rows = soup.find("div", class_="ui-table__row ")
|
| 63 |
data = []
|
| 64 |
#for row in rows:
|
| 65 |
#rank = row.select_one(".tableCellRank")
|
|
|
|
| 93 |
if wd:
|
| 94 |
wd.quit()
|
| 95 |
|
| 96 |
+
return html , div_find, rows
|
| 97 |
|
| 98 |
if __name__ == "__main__":
|
| 99 |
main()
|