Skip to content

we find the Geo Location with help of this script. In this script scrape data from https://ipinfodb.com/ site. this article only for education purpose not for any illegal purpose.

Notifications You must be signed in to change notification settings

codingloverss/Find_Geo_Location_By_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Find_Geo_Location_By_Python

we find the Geo Location with help of this script. In this script scrape data from https://ipinfodb.com/ site. this article only for education purpose not for any illegal purpose.

Code:-

import requests

from bs4 import BeautifulSoup

def Geo_Location(): page=requests.get("https://ipinfodb.com/").text

soup=BeautifulSoup(page,'html.parser')

data=soup.find('table',{'class':'table'})

result=[]

for rows in data.find_all('tr'):

    cols=rows.find_all('td')
    
    if len(cols)>=2:
    
        try: 
        
            result.append([cols[0].text,cols[1].text,cols[2].text])
            
        except:
        
            result.append([cols[0].text,cols[1].text])
            
address={}

ip=soup.find('h1',{'class':'pull-left'}).strong.text.split('-')

address[ip[0].strip()]=ip[1].strip()

for k in range(len(result)):

    for i in result[k]:
    
        address[i.split('\n')[1]]=i.split('\n')[2]
        
return address

if name == "main":

print(Geo_Location())

About

we find the Geo Location with help of this script. In this script scrape data from https://ipinfodb.com/ site. this article only for education purpose not for any illegal purpose.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages