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

Instagram and possibly Skype doesn't seem to work #15

Open
mahmoudalsof opened this issue Sep 8, 2020 · 2 comments
Open

Instagram and possibly Skype doesn't seem to work #15

mahmoudalsof opened this issue Sep 8, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mahmoudalsof
Copy link

I'm trying to fetch the user's Instagram profile pictures but all I get back is a green background with a * in the middle. Checking the source code on your repo I can see that the function publicSearch(username) works when I manually fetch the data but it doesn't seem to be called anywhere at all.
This can easily be demonstrated on your own demo site where you can also see that skype is possibly facing the same issue.

@JorgenEvens
Copy link
Owner

The publicSearch strategy is used here. However it would seem that instagram is detecting requests from this service and serving up the login page instead of the expected response.

I've been looking for a workaround for a while now without success.

@JorgenEvens JorgenEvens added the bug Something isn't working label Sep 15, 2020
@JorgenEvens JorgenEvens self-assigned this Sep 15, 2020
@mahmoudalsof
Copy link
Author

I've dug into the responses and managed to get something working for my website. It's not 100% perfect because I got some users complaining that they are getting the wrong profile picture from Instagram.

Here's my workaround, might be helpful for you to come up with a work around perhaps.

      try {
            const getAvatar = await axios.get(
              `https://www.instagram.com/web/search/topsearch/?query=@${res.data.instagramName}`
            );

            if (getAvatar.data.users.length > 0) {
              setAvatarUrl(getAvatar.data.users[0].user.profile_pic_url);
            } else {
              return;
            }
          } catch (err) {
            console.error(err);
          }

Basically, I search for the user JSON data with their instagram handle, I get an array back but usually the object at the first index is an exact match to the handle provided. I then just access that object's user.profile_pic_url and then use that link as the profile picture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants