Python-proje/presum
0
1from urllib.parse import urlparse2from hespress import scrape_hes3from aljazeera import scrape_aljaz4from mwn import scrape_mwn5import streamlit as st6import validators7 8@st.cache_data9def main_scrape(url):10 if not validators.url(url):11 return "We're sorry, but the link you provided seems to be invalid. Please double-check that the URL is correct and properly formatted."12 13 domain = urlparse(url).netloc14 if "moroccoworldnews.com" in domain:15 return scrape_mwn(url)16 if "en.hespress.com" in domain:17 return scrape_hes(url)18 if "aljazeera.com" in domain:19 return scrape_aljaz(url)20 else:21 return "We're sorry, this website is not currently supported. To see a list of supported websites, click the '?' next to the input option."22 