Feb 7, 2016 08:39 AM
(This post was last modified: Feb 7, 2016 08:43 AM by ExoticModzV1.)
i only wanted to share this code because i see no one use beautifulSoup to grab proxies!!!
coded in 25minutes.
this is an example of how to use bs4 to grab data off tables ^_^
i think more people need to use BeautifulSoup, its a brilliant module, and so easy to scrape data with.
coded in 25minutes.
this is an example of how to use bs4 to grab data off tables ^_^
i think more people need to use BeautifulSoup, its a brilliant module, and so easy to scrape data with.
Code
'''
coded By ExoticModsV1
'''
from bs4 import BeautifulSoup
import urllib2
def GrabProxies():
wfile = open('proxies.txt', 'w')
url = " https :// free-proxy-list .net/"
req = urllib2.Request(url, headers={'User-Agent' : "Magic Browser"})
con = urllib2.urlopen(req)
counter = 0
soup = BeautifulSoup(con)
table = soup.find("table")
for row in table.findAll('tr')[1:100]:
counter = counter + 1
col = row.findAll('td')
col1 = col[0].getText()
col2 = col[1].getText()
f = (col1 + ":" + col2)
wfile.write("\n" + str(col1) + ":" + str(col2))
print(f)
url = " https :// www .socks -proxy .net/"
req = urllib2.Request(url, headers={'User-Agent' : "Magic Browser"})
con = urllib2.urlopen(req)
counter = 0
soup = BeautifulSoup(con)
table = soup.find("table")
for row in table.findAll('tr')[1:50]:
counter = counter + 1
col = row.findAll('td')
col3 = col[1].getText()
col2 = col[-8].getText()
print(col2 + ":" + col3)
f = (col2 + ":" + col3)
wfile.write("\n" + str(col2) + ":" + str(col3))
url = " https :/ /www .us-proxy .org/"
req = urllib2.Request(url, headers={'User-Agent' : "Magic Browser"})
con = urllib2.urlopen(req)
counter = 0
soup = BeautifulSoup(con)
table = soup.find("table")
for row in table.findAll('tr')[1:100]:
counter = counter + 1
col = row.findAll('td')
col1 = col[0].getText()
col2 = col[1].getText()
print(col1 + ":" + col2)
f = (col1 + ":" + col2)


![[Image: N43q1sy.png]](https://i.imgur.com/N43q1sy.png)

