sports
Sunday, 5 January 2025
serch google
import re
import requests
from googleapiclient.discovery import build
# Apna API key aur Custom Search Engine ID yahan daalein
api_key = 'YOUR_GOOGLE_API_KEY'
search_engine_id = 'YOUR_SEARCH_ENGINE_ID'
# Custom search service banayein
service = build("customsearch", "v1", developerKey=api_key)
# URL se emails nikalein
def get_emails(url):
try:
response = requests.get(url)
emails = set(re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', response.text))
return emails
except Exception as e:
print(f"Error with {url}: {e}")
return []
# Google search ka function
def google_search(query):
res = service.cse().list(q=query, cx=search_engine_id).execute()
return res['items'] if 'items' in res else []
# Search query example
query = "contact email site:example.com"
# Google search results hasil karna
results = google_search(query)
# Emails nikaalna
for result in results:
url = result['link']
emails = get_emails(url)
print(f"Emails from {url}: {emails}")
Tuesday, 26 November 2024
Subscribe to:
Posts (Atom)