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/
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…
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.
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.
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)