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/
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?
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:
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…
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’
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
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.
@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!
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.
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)