|
import streamlit as st |
|
import requests |
|
from bs4 import BeautifulSoup |
|
|
|
|
|
def get_section_content(vin): |
|
url = f"https://e-zipavto.com/search/index?SearchForm%5Boption%5D=&SearchForm%5Boption%5D=2&SearchForm%5Bsearch%5D={vin}" |
|
response = requests.get(url) |
|
soup = BeautifulSoup(response.content, 'html.parser') |
|
|
|
|
|
main_content = soup.find('section', id='mainContent') |
|
if main_content: |
|
return main_content.prettify() |
|
else: |
|
return None |
|
|
|
|
|
st.title('Display Section from Web Page') |
|
vin = st.text_input('Enter VIN', '4JGDF2EE4FA506008') |
|
|
|
if st.button('Search'): |
|
if vin: |
|
section_content = get_section_content(vin) |
|
if section_content: |
|
st.write(section_content, unsafe_allow_html=True) |
|
else: |
|
st.write('Section not found or VIN not found.') |
|
else: |
|
st.write('Please enter a VIN.') |
|
|
|
|
|
|