Instagram Graph API Access Tokens with Python

Поділитися
Вставка
  • Опубліковано 4 кві 2020
  • In this video we learn how to get an access token for use with the Instagram Graph API. The access token lasts for 60 days and can be used to have full control over social interactions on an Instagram account as along as the Instagram account is set to either a professional business/creator.
    --
    Code on GitHub ⇛ github.com/jstolpe/blog_code/...
    --
    Discord ⇝ / discord
    TikTok ⇝ / justinstolpe
    GitHub ⇝ github.com/jstolpe/
    Instagram ⇝ / justinstolpe
    Twitter ⇝ / justin_stolpe
    LinkedIn ⇝ / justin-stolpe-3bb05426
    Reddit ⇝ / jstolpe
    Twitch ⇝ / jstolpe
    Facebook ⇝ / stolpejustin
    Website ⇝ justinstolpe.com
    SoundCloud ⇝ / justin-stolpe
    --
    #programming #developer #coding

КОМЕНТАРІ • 80

  • @akuamtau
    @akuamtau 4 роки тому +4

    Great content. The APIs change a lot really quickly so this type of content is seriously helpful

  • @enversdudecor
    @enversdudecor 3 роки тому +17

    For those who ask :
    Permissions
    The manage_pages permission has been deprecated and replaced with 4 new permissions:
    pages_manage_ads
    pages_manage_metadata
    pages_read_engagement
    pages_read_user_content

  • @moosatov
    @moosatov 3 роки тому +1

    Great straight-forward tutorial! Thank you. Wouldn't be able to accomplish it without this.

  • @MechanizeCode
    @MechanizeCode 4 роки тому +1

    Great job and thanks for sharing this knowledge.

  • @ayakovtsev
    @ayakovtsev 3 роки тому +1

    Greate video! Thnks for it!

  • @manojcs2284
    @manojcs2284 3 роки тому +1

    Very good content😊

  • @panchomarquez
    @panchomarquez 3 роки тому

    Excelent content. This help me a lot. Great content.

  • @OnurKapucu
    @OnurKapucu Рік тому +1

    Great content. Thanks!

  • @tarunalakhramsing7861
    @tarunalakhramsing7861 4 роки тому +3

    The content here is Amazing!
    Suprised The Likes Are So Little

  • @egulich
    @egulich 3 роки тому +1

    Great video!

  • @jajupmochi
    @jajupmochi 4 місяці тому

    Thank you! This is super useful! Still work in 2024!

  • @AmanSingh-kp5zw
    @AmanSingh-kp5zw 4 роки тому +11

    Currently , there is no permission such as manage_pages in the API, we do have manage_pages_metadata, are both they same?

    • @muhammedjaabir2609
      @muhammedjaabir2609 3 роки тому +2

      read the doc , they recently changed the publish_posts and and manage_pages to 6 new different permissions so you should add all those

  • @emscherblues
    @emscherblues Рік тому +1

    I tried to follow this, but ran into errors. When I just followed the tutorial, but also when cloning the complete code from github. Not sure if make any mistakes or there were changes after more than two years and the code itself needed some changes. Except from my personal token, ID and secret of course.

  • @rob.sisson
    @rob.sisson 4 роки тому

    Thank you :D

  • @fathulansori435
    @fathulansori435 2 роки тому +1

    thak bro your genius

  • @samuelmiller
    @samuelmiller 4 роки тому +1

    Keep getting this error: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'. Idk why

    • @justinstolpe
      @justinstolpe  4 роки тому

      hmm do you have the correct domain specified and spelled correctly "graph.facebook.com/v6.0/" That error sounds like the url to the enpoint is not configured correctly.

  • @amandafinn1942
    @amandafinn1942 3 роки тому

    Thank you so much! I'm new to programming and this worked on my first try which is not what I'm used to

    • @justinstolpe
      @justinstolpe  3 роки тому +1

      Glad it worked on the first try!

  • @elherediaenc
    @elherediaenc 4 роки тому

    Awesome tutorial, thanks! If I add a Facebook Login on my app, will users(businesses or creators) be able to check their posts, media, etc... ?

    • @justinstolpe
      @justinstolpe  4 роки тому

      As long as the account is connected to a page developers.facebook.com/docs/instagram-api/overview#pages

  • @niceperson6412
    @niceperson6412 Рік тому

    Hey Justin, your video is the rescue! I was also wondering if we could use long lived token ( not yet expired ) to generate a new long lived token.

    • @justinstolpe
      @justinstolpe  Рік тому

      I don't think but I believe the long lived tokens will refresh their expire date when the user uses them. Only way they would expire is if the user does not use the token for 60 days.

  • @yueedwards1
    @yueedwards1 3 місяці тому

    Thanks for creating this video! do i understand it correctly that this approach only works for accessing your own fb/ig accounts' data? i am trying to get all ig business accounts which have posted using a certain hashtag. but i don't have an app. i am confused what i need to do to get the access token.

    • @justinstolpe
      @justinstolpe  2 місяці тому

      Thanks! You can query for posts based on a hashtag. Check out my video on hashtags ua-cam.com/video/TuQt5vW4uTw/v-deo.html

  • @Smoked93POL
    @Smoked93POL Рік тому +2

    video outdated -> 'message': 'Invalid OAuth access token - Cannot parse access token'

  • @jockeytu32
    @jockeytu32 3 роки тому

    Thanks for the instructions!
    How can apply the Facebook Permissions for internal data analysis use?

    • @justinstolpe
      @justinstolpe  3 роки тому

      You can use the facebook graph api explorer tool to generate tokens for use.

  • @zurps
    @zurps 4 роки тому

    Not sure if you can help with this, but I can't seem to get the long lived token, requests gives a "Failed to establish a new connection: [Errno 11001] getaddrinfo failed" error. Any ideas? I think it may be due to forcing https?

    • @justinstolpe
      @justinstolpe  4 роки тому

      I have not seen that "getaddrinfo failed" so I am not quite sure what the issue is. You can also use the Graph API explorer to make requests which makes testing the endpoints easier developers.facebook.com/tools/explorer/

    • @egulich
      @egulich 3 роки тому +1

      Hey I had this issue as well. It is most likely that you spelled something wrong. In my case I typed "graph.facebook.com" instead of "graph.facebook.com/". The difference here was the "/". I found this error from "(host='graph.facebook.comv10.0', port=443)" and noticed that there was no slash in there. This was my issue, so you might have had an issue similar to mine.

  • @naheliegend5222
    @naheliegend5222 3 роки тому +1

    I am totally confused about the Facebook and instagram thing. There is an endpoint to create an IG-APP long-lived-access-token as well... why not using it?

    • @justinstolpe
      @justinstolpe  3 роки тому +1

      Yeah I could make a video for it

  • @arunreghu7338
    @arunreghu7338 4 роки тому

    Using these graph APIs can we get Instagram user-created posts within a particular hashtag?

    • @justinstolpe
      @justinstolpe  4 роки тому

      I do not think you can search for a users posts with a hashtag through the API. You could however grab and store all the users posts, then write a script that searches each post for a hashtag.

  • @DataPro360
    @DataPro360 3 роки тому

    congratulations, your content helped me a lot.
    How can I do to implement webhook in this code in python, would you have any documents or videos to help me?
    Thank you Fernandes Brazil

    • @justinstolpe
      @justinstolpe  3 роки тому

      Thanks, I do have one on webhook ua-cam.com/video/82cpdEisqsA/v-deo.html you could get an overview and write it in python

  • @maheshbarge3222
    @maheshbarge3222 4 роки тому

    i want to do the same for creator account

  • @CR-rm8rb
    @CR-rm8rb 2 роки тому

    When I run the debug_access_token.py script, I get indentation errors in the w10 command prompt. Any ideas?

    • @justinstolpe
      @justinstolpe  2 роки тому

      hmm not sure have not seen that error before

  • @matiasdipaola3342
    @matiasdipaola3342 3 роки тому

    Thanks for the tutorial series justin , really helpfull!. I have trouble with the IG permissions when generating the access token, facebook denied and send me to an app review, so when I want to retrieve the data object in the response, it is empty. Has anyone here had a similar issue? I ve created a new facebook page (almost empty) to link my instagram, could this be the problem? Thank you!

    • @justinstolpe
      @justinstolpe  3 роки тому +1

      When your app is in live mode, it needs to be reviewed and approved before you can start getting live data. This is probably why you are not getting anything in your response.

  • @GeneralBlorp
    @GeneralBlorp 3 роки тому

    Why use string yes/no parameter when you have a binary outcome that could easily take True/False? Wouldn't that be easier to read and therefore more "correct" per the Pythonic mantra?

    • @justinstolpe
      @justinstolpe  3 роки тому

      I probably had some reason at the time for doing so but don't recall, using true/false would be more correct

  • @parthpatankar8340
    @parthpatankar8340 4 роки тому

    I don't have redirect url. What should I put?

  • @sohamjadhav5001
    @sohamjadhav5001 Рік тому +1

    Heyy Great content! By the way I have an error for the long lived token saying that "Unsupported get request, Object with ID 'v6.0oauth' does not exist, cannot be loaded due to missing permissions. "

    • @justinstolpe
      @justinstolpe  Рік тому

      Thanks! That error is saying you are trying to pass an object ID of "v6.0auth" which is not an ID. Check and make sure your ids are in the correct spots and the request and endpoint string are defined correctly.

  • @nandafadhli869
    @nandafadhli869 10 місяців тому

    Hi Justin, Is this possible to use that token to do instagram scrapping?

    • @justinstolpe
      @justinstolpe  10 місяців тому

      You can use the access tokens to get data from endpoints as long as the users account is not a personal private account.

  • @joedelorimier4454
    @joedelorimier4454 4 роки тому

    Is there any way you could demo accessing another instagram user's data? What does that permission process look like?

    • @joedelorimier4454
      @joedelorimier4454 4 роки тому

      It would be interesting to be able to have count of likes, count of comments, and the date for each post that a user (not you) made

    • @justinstolpe
      @justinstolpe  4 роки тому

      Here is what the permission process would look like ua-cam.com/video/RTwzPdMoTg0/v-deo.html

    • @justinstolpe
      @justinstolpe  4 роки тому

      This is possible with the Insights endpoints. I will be making a video for getting Insights with the Instagram Graph API using python.

    • @joedelorimier4454
      @joedelorimier4454 4 роки тому +1

      ​@@justinstolpe Okay awesome! Really appreciate these videos and all the time you put into them. So super helpful.

  • @naheliegend5222
    @naheliegend5222 3 роки тому

    /debug_token does not work. placed my access_token as input_token and access_token and I don't get a proper response. WHY? This API drives me nuts.

    • @justinstolpe
      @justinstolpe  3 роки тому

      Yeah the API can be frustrating especially with no response. Maybe try the graph explorer tool at developer.facebook.com to get more insight into your token.

    • @naheliegend5222
      @naheliegend5222 3 роки тому

      @@justinstolpe thank you. Yes, that is the way I will go.

  • @felicemcc
    @felicemcc 3 роки тому +1

    Please normalize your audio and thanks so much for the tutorial and code.

  • @parthpatankar8340
    @parthpatankar8340 4 роки тому

    Also how can I get access toke without manually copying it from developers app..coz I will be giving my app to someone else to use it and they cannot do that...
    Please help..please

    • @justinstolpe
      @justinstolpe  4 роки тому +1

      Without manual copying from the developers app you have to implement something like this ua-cam.com/video/dEDKOcPuXlU/v-deo.html

    • @parthpatankar8340
      @parthpatankar8340 4 роки тому

      @@justinstolpe yes I saw that video. And in that u put a redirect url..I don't have redirect url nor webpage...
      I just want my python app to login into account get access token and do analysis on fetched data...so how can I do that?

    • @parthpatankar8340
      @parthpatankar8340 4 роки тому

      @@justinstolpe also is there way to do this with python

    • @parthpatankar8340
      @parthpatankar8340 4 роки тому

      ??

    • @justinstolpe
      @justinstolpe  4 роки тому

      @@parthpatankar8340 You need to present users with a facebook login dialog so they can authorize your app. This is the only way to get the access token.

  • @hossein824
    @hossein824 3 роки тому +1

    why are you still using python2?

    • @justinstolpe
      @justinstolpe  3 роки тому

      It is just what got installed way back when I installed cygwin, I did not notice until you mentioned it, time for upgrade :D

  •  2 роки тому

    Is this video at 1.25x? :'D