Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Python to secretly capture her whereabouts behind her back

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you about how to use Python to secretly capture the whereabouts of his girlfriend behind her back. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

1. Target scene

Sometimes my girlfriend plays outside alone and asks her where she is, but she won't tell me. However, you really want to know the "location" of your girlfriend. What should you do?

In fact, you can do this to your girlfriend by pretending that you are bored at home. You can help her fix the picture and ask her to send you the original picture on Wechat. After getting the original picture of Wechat, you can use Python to quickly get the exact location of your girlfriend.

two。 Preparatory work

First, install a library that identifies picture metadata in a virtual environment.

Pip3 install exifread

Then, enter the Gaode open platform, apply for an Web service application, and get a "Key" for inverse geocoding API.

3. Write a script

The whole operation is divided into three steps, namely, obtaining the longitude and latitude of the image, correcting the longitude and latitude, and calling Gao de inverse geocoding API to obtain the specific location.

Step 1, get the longitude and latitude of the picture.

Using the exifread library, you can read the picture file directly and get the metadata of the picture, including longitude, latitude, north-south latitude, east-west longitude and shooting time.

# use exifread to get the metadata of the picture img_exif = exifread.process_file (open (self.img_path, 'rb')) # can read the attribute if img_exif: # latitude latitude_gps = img_exif [' GPS GPSLatitude'] # N S north and south latitude latitude_direction = img_exif ['GPS GPSLatitudeRef'] # degrees of longitude longitude_gps = img_exif [' GPS GPSLongitude'] # EMagol W east-west longitude longitude_direction = img_exif ['GPS GPSLongitudeRef'] # shooting time take_time = img_exif [' EXIF DateTimeOriginal']

If the metadata exists, then determine whether the shooting time is reasonable. If the shooting time is not today, I can only regret to inform you that your girlfriend is lying to you.

Def judge_time_met (self, take_time): "determine whether the shooting time is today: param take_time:: return:"# shooting time format_time = str (take_time) .split (") [0] .replace (":" "-") # same day date today = str (datetime.date.today ()) if format_time = = today: return True else: return False if is_lie: print ('I regret to inform you Your girlfriend is lying!) Return

If your girlfriend is not lying, you can do step 2.

Because there is a certain error in the longitude, latitude and Amap's coordinates obtained through GPS, the coordinates need to be converted to the "Martian coordinate system".

X_pi = 3.14159265358979324 * 3000.0 / 180.0 pi = 3.1415926535897932384626 π a = 6378245.0 # long axis ee = 0.00669342162296594323 # oblateness def wgs84togcj02 (lng, lat): "" WGS84 to GCJ02 (Mars coordinate system): longitude of param lng:WGS84 coordinate system: latitude of param lat:WGS84 coordinate system: return: "" if out_of_china (lng) Lat): # judge whether return lng is in China, lat dlat = transformlat (lng-105.0, lat-35.0) dlng = transformlng (lng-105.0) Lat-35.0) radlat = lat / 180.0 * pi magic = math.sin (radlat) magic = 1-ee * magic * magic sqrtmagic = math.sqrt (magic) dlat = (dlat * 180.0) / (a * (1-ee)) / (magic * sqrtmagic) * pi) dlng = (dlng * 180.0) / (a / sqrtmagic * math.cos (radlat) * pi) mglat = lat + Dlat mglng = lng + dlng return [mglng Mglat]

In addition, it should be noted that the longitude and latitude parameters in the interface can only identify 6 decimal places, and the degrees, minutes and seconds in longitude and latitude need to be processed and then rounded.

Def _ _ format_lati_long_data (self, data): processing longitude and latitude data Keep 6 decimal places: param data: original longitude and latitude values: return: "" # remove the left and right parentheses and spaces data_list_tmp = str (data). Replace ('[','). Replace (']','). Split (' ') data_list = [data.strip () for data in data_list_tmp] # replacement second value data_tmp = data_list [- 1] .split (' /') # second value data_sec = int (data_tmp [0]) / int (data_tmp [1]) / 3600 # replacement score value data_tmp = data_list [- 2] # minute The value data_minute = int (data_tmp) / 60 # degrees data_degree = int (data_list [0]) # because Gaud API can only recognize 6 digits after the decimal point # needs to be converted to a floating point And leave it to 6 decimal places result = "% .6f"% (data_degree + data_minute + data_sec) return float (result)

Step 3, call Gaud's anti-geocoding API, input the application Key, and you can get the detailed address of your girlfriend.

Def _ get_address (self, location): "" according to the coordinates, get the detailed address: param location: longitude and latitude: return: "" resp = requests.get (self.url_get_position.format (self.api_key, location)) location_data = json.loads (resp.text) address = location_data.get ('regeocode'). Get (' formatted_address') return address

4. Results conclusion

Make sure that the picture is based on the original picture, which can quickly help you determine whether your girlfriend is lying; if your girlfriend is not lying, return to your girlfriend's specific location.

This is how the editor shared with you how to use Python to secretly grab her whereabouts behind her back. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report