-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathnumber_location.py
61 lines (35 loc) · 1.31 KB
/
number_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
48
49
50
51
52
53
54
55
56
57
58
59
'''
Phone number tracker
Created by *Abdullah EL-Yamani*
-----------------------------
Link Youtube Video => https://youtu.be/Geisa_ib5hs
Youtube Channel => Sam Codes
'''
import phonenumbers
from phonenumbers import geocoder, carrier, timezone
from opencage.geocoder import OpenCageGeocode
import folium
number = "+xxxxxxxxxxxxx" # +CodeCountry PhoneNumber
key = "xxxxxxxxxxxxxxxxxxxxxxxxxx" # From => https://opencagedata.com/dashboard#geocoding > API Keys
san_num = phonenumbers.parse(number)
your_location = geocoder.description_for_number(san_num, "en")
print("Country Name => ", your_location)
print("----------------------\n")
# get service provider
service_provider = phonenumbers.parse(number)
telecom_company = carrier.name_for_number(service_provider, "en")
print("Telecom Company Name => ", telecom_company)
print("---------------------------------\n")
geocoder = OpenCageGeocode(key)
query = str(your_location)
results = geocoder.geocode(query)
print(results)
lat = results[0]['geometry']['lat']
lng = results[0]['geometry']['lng']
print("\n-------------------------------")
print("x =", lat," y =", lng)
print("-------------------------------\n")
location = [lat, lng]
Map = folium.Map(location=location, zoom_start=10)
folium.Marker(location, popup = your_location).add_to(Map)
Map.save("loc_map.html")