ഗൂഗിൾ സെർച്ച് ഉപയോഗിച്ച് പൈത്തണിലെ ഒരു ലളിതമായ പൊതു പ്രോക്സി പാഴ്സർ. ഞങ്ങൾ ഉപയോഗിക്കും googlesearch-python
ഗൂഗിൾ തിരയലുകൾ നടത്തുന്നതിനുള്ള ലൈബ്രറിയും BeautifulSoup
HTML പാഴ്സിങ്ങിന്.
ആദ്യം, നിങ്ങൾക്ക് ആവശ്യമായ ലൈബ്രറികൾ ഇൻസ്റ്റാൾ ചെയ്തിട്ടുണ്ടെന്ന് ഉറപ്പാക്കുക:
pip install beautifulsoup4 google
ഇപ്പോൾ, നമുക്ക് പ്രോക്സി പാഴ്സർ സൃഷ്ടിക്കാം:
from googlesearch import search
from bs4 import BeautifulSoup
import requests
def fetch_proxies():
proxies = []
# Perform a Google search for public proxy lists
query = "public proxy list"
for url in search(query, num=5, stop=5, pause=2):
# Fetch the HTML content of the search result
try:
response = requests.get(url, timeout=10)
if response.status_code == 200:
html_content = response.text
# Parse the HTML using BeautifulSoup
soup = BeautifulSoup(html_content, 'html.parser')
# Find proxy IP addresses and ports
for row in soup.find_all('tr'):
cols = row.find_all('td')
if len(cols) >= 2:
proxy = cols[0].text.strip() + ':' + cols[1].text.strip()
proxies.append(proxy)
except Exception as e:
print(f"Error fetching proxies from {url}: {e}")
return proxies
if __name__ == "__main__":
proxies = fetch_proxies()
for proxy in proxies:
print(proxy)
ഈ സ്ക്രിപ്റ്റ് പൊതു പ്രോക്സി ലിസ്റ്റുകൾക്കായി ഒരു Google തിരയൽ നടത്തുകയും തിരയൽ ഫലങ്ങളുടെ HTML പാഴ്സ് ചെയ്യുകയും പ്രോക്സികളുടെ IP വിലാസങ്ങളും പോർട്ടുകളും എക്സ്ട്രാക്റ്റുചെയ്യുകയും ചെയ്യും. ഈ രീതി ഉപയോഗിച്ച് ലഭിച്ച പ്രോക്സികളുടെ ഗുണനിലവാരവും വിശ്വാസ്യതയും വ്യത്യാസപ്പെടാം എന്നത് ശ്രദ്ധിക്കുക. കൂടാതെ, പ്രോക്സികൾ എല്ലായ്പ്പോഴും ഉത്തരവാദിത്തത്തോടെ ഉപയോഗിക്കുന്നുണ്ടെന്നും അവയിലൂടെ നിങ്ങൾ ആക്സസ് ചെയ്യുന്ന വെബ്സൈറ്റുകളുടെ സേവന നിബന്ധനകൾ പാലിക്കുന്നുണ്ടെന്നും ഉറപ്പാക്കുക.
അഭിപ്രായങ്ങൾ (0)
ഇവിടെ ഇതുവരെ അഭിപ്രായങ്ങളൊന്നുമില്ല, നിങ്ങൾക്ക് ആദ്യത്തെയാളാകാം!