-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphone_location.py
48 lines (29 loc) · 1.09 KB
/
phone_location.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Phone number tracker
Created by *Abdullah EL-Yamany*
Channal Name => Simplilearn
Link Video => https://youtu.be/DY4M9bAVyUc
"""
import phonenumbers
from phonenumbers import geocoder
import folium
number = "+xxxxxxxxxxxxx" # +CodeCountry PhoneNumber
check_number = phonenumbers.parse(number)
number_location = geocoder.description_for_number(check_number, "en")
print(number_location)
#-----------------------------------
from phonenumbers import carrier
service_provider = phonenumbers.parse(number)
print(carrier.name_for_number(service_provider, "en"))
#-----------------------------------
key = "xxxxxxxxxxxxxxxxxxxxxxxxxx" # From => https://opencagedata.com/dashboard#geocoding > API Keys
from opencage.geocoder import OpenCageGeocode
geocoder = OpenCageGeocode(key)
query = (str(number_location))
results = geocoder.geocode(query)
lat = results[0]['geometry']['lat']
lng = results[0]['geometry']['lng']
print(lat, lng)
map_location = folium.Map(location = [lat, lng], zoom_start=9)
folium.Marker([lat, lng],popup=number_location).add_to(map_location)
map_location.save("myLocation.html")