Instagram Authenticate

This component will authenticate and generate the necessary access token needed to request data from Instagram. From there, simple calls to the Instagram API endpoints will generate the requested data. The external ‘requests’ library is included in the project folder so you don’t need to install it manually. However, if you have it installed you can remove it from the project folder.

Simply register an app with Instagram and fill out the required Client Info fields in the component. Once filled in simply pulse the Authenticate button to create the access token.

Once authenticated, update the ‘endpointURL’ DAT to your choosing and the ‘requestsEndpoints’ DAT Execute will print the data to the text port. From there you can choose how you would like to use the data.

Lastly, this will run in Sandbox Mode unless approved by Instagram. I recommend reading up on the restrictions while in Sandbox Mode - instagram.com/developer/sandbox/

-Colin
instagramAuthenticate.zip (868 KB)

Hello there!

Im checking your work and trying to do it, but always gave me an error…

Screenshot (28).png

I did all step on instagram API developer… but dont work.

Still working this file??

Regards

Javo

Looks like its not seeing requests library on your machine. Did you install it into a Python installation on your system and then point the TouchDesigner preferences at the site packages folder?

No :astonished:

I dont know exactly what i need to install, im going to check it in forum better, before ask as a dumb guy :wink:

Thanks Elburz

Everyone’s got to learn somewhere, don’t even worry! I had written an example of how to add a third party Python library (turns out the be requests) in the readme of this talk I gave:

github.com/elburz/PyConCa2015-TouchDesigner

You should be able to follow the instructions then proceed to use Colin’s component.

Thanks Elburz!

i will check it today… nice work dude

Regards

Javo

Hi lightnotes,

Yea, I’ve been meaning to update this at some point into a simple extension with some added functionality. Via the ‘Library’ drop down parameter you can choose either the ‘requests’ or ‘urllib’ library to authenticate. The ‘urrlib’ library is native to Python so you don’t need to download any external library. However, by default it’s set to the ‘requests’ library which is much cleaner and simple to use. Thus, as Elburz said, you need to download the ‘requests’ library for the scripts to run.

That being said, attached is a modified project file with the physical ‘requests’ library included in the ‘pyllib’ folder. I’ve altered the scripts to import the module for you automatically from the folder. This way, you technically don’t need to have the ‘requests’ library installed on your machine for it to work.

However, if you are new to Python and TouchDesigner I would recommend getting a proper Python environment going where you can install external modules such as ‘requests’ quite easily via ‘pip’ in command line. See below…

  1. Download Python python.org/downloads/
  2. Install to default directory --> Ensure you check mark the box saying ‘Add Python to PATH’ at the bottom of the installer
  3. Open Command Prompt
  4. Type pip install requests
  5. Set your Python ‘site-packages’ folder in TouchDesigner --> Preferences --> Python 64-bit Module Path - C:/Users/username/AppData/Local/Programs/Python/Python35/Lib/site-packages

Now you can install any external Python library and simply import them in your scripts within TouchDesigner.
instagramAuthenticate.zip (869 KB)

1 Like

Colin, I did similar for our twitter tox. Might not be best practice but it works and saves some headaches moving it around, ¯_(ツ)_/¯

Can you remove the old download or edit that post to replace the file with your new one?

Yea I agree somewhat ugly, but a slick method nonetheless if you don’t have full control of target machine libraries. I learned it from the Python wiki - under ‘Importing Modules’

derivative.ca/wiki088/index. … n_Tutorial

Updated the original post w/update - completely removed the ‘urrlib’ library option.

1 Like

Agreed

Ok now its working!, but second question… how can i get now after authenticate pictures from that instagram user or any hashtag?

Thanks

Javo

Hi,

I’m looking into this TOX as it seems to be just what I need (thank you!), I’ve got over the requests issue (again thank you!) and now its throwing up this as an error

any thoughts?

Thanks

Andy

Not sure if it’s related but most of the API is closing down (if it hasn’t already been closed down), so unless you’re using the new Business API credentials and end points, you might have issues. Alternatively, we have an Instagram scraper on store.nvoid.com that doesn’t require credentials to grab media.

store.nvoid.com/2018/01/19/instagramtools/

@elburz, does your Nvoid instagram tool support scrubbing by geo location or hashtag, or is it only for following a table of users? Is there functionality to post from TD? Thanks!

Hi Guys!

Im trying to build this project. Instagram Feed from a specific HASHTAG. I used the mapping tutorial with ITTTF, but i cant choose the hastag, only photos uploaded by me. Is this TOX working?

@drmbt - Sorry for the delay, didn’t see the notification. Our tool only scrapes user feeds because it’s a scraped that doesn’t require API credentials.

@Deushas - Our tool doesn’t search by hashtag, it scrapes media off user feeds.

I can’t comment on prochoy’s tool though, maybe he can chime in.

your scraper only work on PC?

Yup, at the moment it uses chrome driver which is an Exe version of chrome that it runs with Selenium. Not sure how hard it would be to hack for Mac, but I would start by seeing if Selenium (Python library) works with Mac, and how to get it up and running, then it might just be as quick as replacing the path for chromedriver.exe with whatever you’d be using on Mac.

1 Like

ok. got it after a bit of wrangling and googling…
for others trying…
pip install -U selenium
pip install -U lxml

then download chromedriver for mac, and add to Elburz IO Tools/Extras/PythonLibs
In InstagramTools component go into scraper and edit the scraper DAT and change line 59 to:
driver = webdriver.Chrome(newpath + ‘/chromedriver’, chrome_options=options)

I was then getting lxml error: “bs4.FeatureNotFound: Couldn’t find a tree builder with the features you requested: lxml. Do you need to install a parser library?”

so changed to use html parser, by changing line 103 to:
soup = BeautifulSoup(page, ‘html.parser’)

and voila, it works. hope this helps someone (us poor mac guys)

@radarboy3000 nice work getting it ported over!