subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

Implement location_search by name and id #9

Closed adw0rd closed 3 years ago

Sebsebzen commented 3 years ago

Hi, is it possible to search for GEO coordinates yet?

adw0rd commented 3 years ago

location_search - by coordinates https://github.com/adw0rd/instagrapi/blob/master/instagrapi/location.py#L10 More examples here - https://github.com/adw0rd/instagrapi/blob/master/tests.py#L798

jhd3197 commented 3 years ago

@adw0rd I ran into an issue when I was adding locations to (photo_upload) it's picking always a different location and it's because the function (location_info) doesn't return Location.external_id and this force the function (location_build) to do a location_search base on the lat and lng so this causing the locations to be wrong most of the time or not perfect here is and example of location_search_pk and location_info

`from instagrapi import Client import sys import json

cl = Client()

loc=cl.location_info(319703195161335) print(loc)

loc1=cl.location_search_pk(319703195161335) print(loc1)`

image

I also added the function location_search_name(name) example

`from instagrapi import Client import sys import json

cl = Client()

locs=cl.location_search_name("caracas") print(locs) ` return

image

Here is the fork with the changes https://github.com/jhd3197/instagrapi/commit/df025a1f54f9659908629e3f197030e882aecfeb

Best hope this can help

adw0rd commented 3 years ago

@jhd3197 You ran tests?

jhd3197 commented 3 years ago

@adw0rd I did and I got this:

image

but I don't know how to debug this or how to check if those errors are coming from this change I also try testing this repository without making any change and I always get a login issue when I'm trying to test with docker even when I know the password it's correct

image

adw0rd commented 3 years ago

Added FbSearchMixin.fbsearch_places:

>>> cl.fbsearch_places('New York')[0].dict()
{'pk': 486560663,
 'name': 'New York City, N.Y.',
 'phone': '',
 'website': '',
 'category': '',
 'hours': {},
 'address': None,
 'city': None,
 'zip': None,
 'lng': -74.005891084671,
 'lat': 40.712701423445,
 'external_id': 267185200114218,
 'external_id_source': 'facebook_places'}