Skip to content

Commit

Permalink
Merge pull request #13 from GSA/alert-autofix
Browse files Browse the repository at this point in the history
Fix code scanning alert no. 8: Incomplete URL substring sanitization
  • Loading branch information
Cybonto authored Oct 21, 2024
2 parents 946769c + da2ff4d commit a0b0051
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
try:
with st.spinner("Please wait..."):
# Load URL data
if "youtube.com" in url:
from urllib.parse import urlparse
parsed_url = urlparse(url)
if parsed_url.hostname and (parsed_url.hostname == "youtube.com" or parsed_url.hostname.endswith(".youtube.com")):
loader = YoutubeLoader.from_youtube_url(url, add_video_info=True)
else:
loader = UnstructuredURLLoader(urls=[url], ssl_verify=False, headers={"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_5_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"})
Expand Down

0 comments on commit a0b0051

Please sign in to comment.