Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user.instagram_username() returns "Tinder" -- fix #207

Open
MMcintire96 opened this issue Mar 28, 2019 · 2 comments
Open

user.instagram_username() returns "Tinder" -- fix #207

MMcintire96 opened this issue Mar 28, 2019 · 2 comments

Comments

@MMcintire96
Copy link

Here is my proposed fix, if someone wants to make it use the python standard html.parser library that would be much appreciated. Also code is not tested formally but seems to work for most situations (picture, private_user, normal_user).

import requests
from bs4 import BeautifulSoup
import re
def instagram_username(self):
    if "instagram" in self._data:
        x = requests.get(self._data['instagram']['photos'][0]['link']).text
        soup = BeautifulSoup(x, 'html5lib')
        meta_str = soup.find('meta',
                 attrs={'property': 'og:description'})['content']
        ig_uname = re.findall('@[^\s|\W]*', meta_str)
        return ig_uname[0][1:]
        #return self._data['instagram']['username']

@seteBR
Copy link

seteBR commented Sep 7, 2019

Still working?
Got an error.

x = requests.get(self._data['instagram']['photos'][0]['link']).text

KeyError: 'link'

@MMcintire96
Copy link
Author

No, it appears that the api has changed and now the Instagram[] does not contain "photos". I searched through the useable content in Instagram[] ("image", "thumbnail" and "profile_photo") but they all appear to be links to the cdn. The cdn's page has no way of locating the user.

I think this has been changes with FB/IG's protocol rather than Tinder's, but unfortunately I can't find any way to get instagram_username anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants