I simple webscraping tool

+2 Steven Anders · September 4, 2014

import requests
from bs4 import BeautifulSoup


def ipscrape():
    url = 'http://www.myipaddress.com/show-my-ip-address/'
    pageSource = requests.get(url)
    pageSourceText = pageSource.text
    soup = BeautifulSoup(pageSourceText)
    for link in soup.findAll('b'):
        print(link.string)


ipscrape()



#Don't try and use this program more than once in a short period of time or the server will deny you the webpage!

This little script with parse a website to find your ip address!

Post a Reply

Replies

Oldest  Newest  Rating
0 Isaiah Rahmany · September 5, 2014
Hey they only deny it because you don't have any headers your using the python header...
0 Isaiah Rahmany · September 5, 2014
Other than that good job!
0 Isaiah Rahmany · September 5, 2014
And if your connected to the deep web using privoxy and tor network they won't know who you are each time lol
your just get random ip's xD
0 Steven Anders · September 6, 2014
Could you explain how I could fix it?
0 Isaiah Rahmany · September 6, 2014
headers = {}
url =  'some crap'
headers['User-Agent'] = 'Mozilla 5.0'

r = request.get(url, headers=headers)

data = r.text

soup = BeautifulSoup(data)

etc...
0 Steven Anders · September 6, 2014
Thanks a ton!
  • 1

Python

107,273 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator