Advertisement
UF6

Scanner

UF6
Nov 21st, 2023
1,038
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | Source Code | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. def search_web_for_phrase(url, target_phrase):
  5.     try:
  6.         # Send a GET request to the URL
  7.         response = requests.get(url)
  8.  
  9.         # Check if the request was successful (status code 200)
  10.         if response.status_code == 200:
  11.             # Parse the HTML content of the page using BeautifulSoup
  12.             soup = BeautifulSoup(response.text, 'html.parser')
  13.  
  14.             # Find all text content within the page
  15.             page_text = soup.get_text()
  16.  
  17.             # Check if the target phrase exists in the page text
  18.             if target_phrase in page_text:
  19.                 print(f"Found '{target_phrase}' on {url}")
  20.             else:
  21.                 print(f"'{target_phrase}' not found on {url}")
  22.         else:
  23.             print(f"Failed to fetch {url}. Status code: {response.status_code}")
  24.  
  25.     except requests.RequestException as e:
  26.         print(f"Error: {e}")
  27.  
  28. # Example usage:
  29. url_to_scan = "https://www.addsitehere.com"  # Replace with your desired URL
  30. phrase_to_find = "Your Phrase Here"  # Replace with the phrase you want to search for
  31.  
  32. search_web_for_phrase(url_to_scan, phrase_to_find)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement