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

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FormatException: Unexpected character (at character 1) #13

Open
DheCastro opened this issue Feb 17, 2021 · 25 comments
Labels
Hacktoberfest help wanted Extra attention is needed

Comments

@DheCastro
Copy link

I'm getting this error, using version 1.0.4 of the package. I managed to fix it locally, but from what I saw it looks like it has already been fixed. I would like to clear that doubt.

If it hasn't been fixed, I would like to help.

@Spidy-crypto
Copy link

@DheCastro
I got this error.
That's why i can't build the application.
Can you please help me with this. :)

@devon2018
Copy link

Getting the same error with version 0.1.4 think it could be a request throttling error from instagram is it worked the first few times i tried and then i started getting this issue.

@DavideM12
Copy link

Yes, I have the same error with version 0.1.4.
It work only for few times. Now this error.
Can you fix it?

@yusuftogtay
Copy link

User_token does not exist in the api connection used. Instagram only allows a few shows. When I examine the code in the library, there is no auth key or user_token. I am thinking of reviewing the Instagram Api documentation and making a contribution.

@DavideM12
Copy link

The old public API is deprecated (on Oct 2020). We should use the oEmbed API.
It seems we have to do something like
https ://graph.facebook.com/v10.0/instagram_oembed?url=https ://www.instagram.com/p/abc/&html&access_token=12345

@noelli
Copy link

noelli commented Apr 8, 2021

Haven't looked into the Packages' code so far but it seems we have to add the following to eliminate such request limitations:

  1. Facebook Developer Tokens
  2. Authentication for Instagram Users to get access_tokens and view details of private Profiles

According to this: Instagram Basic Display API

@yusuftogtay are you already on it? Maybe i would look into it too if i find time.
@viralvaghela would you consider merging a pr with these changes? Or do you have another scope for this package?

@viralvaghela
Copy link
Owner

Hello, I have looked into package code, and that public API is still working fine
Screenshot (7)

@DavideM12
Copy link

@viralvaghela Yes, it's true. But after few requests from the app where we have implemented your package, we cannot get the information anymore. It seems due to new Instagram policy about API

@noelli
Copy link

noelli commented Apr 8, 2021

Yes, that still works.

But Instagram has a limitation for, i believe 100 Requests per hour. It depends on the type of App one is developing if that is enough.

But while developing, where hot reload may be triggering alot of requests that limit is reached very quickly.
Maybe a clear Error Exception or a note in the Readme would be enough, so that new devs using the package remember to not trigger getProfileData() on each widget build but instead i.E. on App open and then on manual reload.

@viralvaghela
Copy link
Owner

viralvaghela commented Apr 21, 2021

Hi @DavideM12 , if you want you can implement oEmbed API and contribute to this package :)

@DavideM12
Copy link

Thank you @viralvaghela but I don't have enough time right now. I'm busy with my full-time job and other small project :(

@viralvaghela viralvaghela added the help wanted Extra attention is needed label Apr 27, 2021
@ValentinAhrend
Copy link

Hello!
I had a similar problem while programming a instagram bot. When running the url in Chrome, with all your own data, it will work, but if you run it with Postman or in Tor (without your data, cookies), it will send you to the log in view.
How to solve it?
I just collected the cookies of my Chrome Browser and implemented it in the request.

So I checked which cookies are needed and found out, that only the sessionId, rur and shbid are needed.
rur=FTW; shbid=480

The sessionId is almost unique, but sending the same again, does not produce any damage.

@ValentinAhrend
Copy link

ValentinAhrend commented May 31, 2021

@viralvaghela
could you edit the getProfileData method to something like this:
Future<void> getProfileData(String username, String sessionId) async { var res = await http.get(Uri.encodeFull(url + username + "/?__a=1"), headers: {"Cookie": "rur=FTW; shbid=480; sessionid="+sessionId}); var data = json.decode(res.body); var graphql = data['graphql']; var user = graphql['user']; var biography = user['biography']; _bio = biography; var myfollowers = user['edge_followed_by']; var myfollowing = user['edge_follow']; _followers = myfollowers['count'].toString(); _following = myfollowing['count'].toString(); _website = user['external_url']; _imgurl = user['profile_pic_url_hd']; _feedImagesUrl = user['edge_owner_to_timeline_media']['edges'].map<String>((image) => image['node']['display_url'] as String).toList(); this._username=username; }

The change is in 2nd line

@ValentinAhrend
Copy link

This solved the issue for me...

@deepss1
Copy link

deepss1 commented Jul 2, 2021

@ValentinAhrend

Thank you for sharing this.

However can you please share from where do you get the Session ID ?

Can it be generated Client Side or has to be a Instagram Server Side generated Session ID ?

Thanks,
Deep

@ValentinAhrend
Copy link

ValentinAhrend commented Jul 2, 2021

@deepss1 I received the sessionId using a heroku spring boot application, that uses selenium to login into Instagram and then getting the cookie. You need a logged in account to get this cookie. For me heroku web server was the best solution, because it is free. The users tries to use the currently uploaded sessionId and if it does not work, the sessionId will be updated. The sessionId is available for multiple tries.

@deepss1
Copy link

deepss1 commented Jul 5, 2021

@ValentinAhrend

Thanks for the explanation.

So did you use a headless browser ? Can you share the Heroku code with me ?

It did be great if you can so I will not have to troubleshoot Selenium and can focus on better things on the platform I will be working on.

Thanks mate

@ValentinAhrend
Copy link

ValentinAhrend commented Jul 5, 2021

@deepss1 I made a repo about it. @ProjectAdApp is basically me, so here: https://github.com/ProjectAdApp/isdp
I deleted some stuff for security reasons. No Problem!

@chaudharyjatin115
Copy link

hey i just wanted to download some reels in my app and faced the same error is it fixed or do i need to help?

@SeanOThomas
Copy link

It seems like each network IP is limited X number of requests. Have we confirmed that it's 100 requests? Anyone come up with a workaround?

@chaudharyjatin115
Copy link

oh could you please help me find some docs related to api?

@DavideM12
Copy link

DavideM12 commented Nov 16, 2021

oh could you please help me find some docs related to api?

I think this could be good:
https://developers.facebook.com/docs/instagram-basic-display-api/getting-started

@chaudharyjatin115
Copy link

thanks for the help

@mehbooburrehman
Copy link

hello ! how did you fix it ? can you please help ?

@UmangKaklotar
Copy link

from where i will get session id??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests