NOTE: As of a long time ago, I have not been keeping up with any of the API changes. If you want to maintain this, go ahead. But currently it is not and has not been kept up to date with the APIs.
Twitter, Vine, and Instagram Hashtag Feed
Get all Twitter and Vine posts with a certain hashtag, print the feed, and save to a database for future use.
How it works
- Searches Twitter for images with the hashtag and saves them to the database.
- Searches Twitter for links with the hashtag and a link containing
vine.co
, parses the link's contents for thetwitter:player:stream
andtwitter:image
meta properties and saves the mp4 video link and video placeholder to the database. - Only performs the above API calls every 2 minutes to avoid rate limiting.
- Shows the feed of the pictures and videos from the database, and refreshes the feed every five minutes.
Configurations
-
Set the hashtag to be pulled in config.php.
-
Backups are located here.
- Place database credentials into config.php.
Create a Twitter application
- Sign in with Twitter Developer
- Hover over your name in the top right corner then click "My Applications"
- Create a New Application. Enter a name (this is for your reference), a description (again for your reference), and your site's URL. The callback URL is a moot point for the use of the application so it can be left blank.
- Create my Access Token (this is a button, click it)
- View the details tab. Copy and paste the correlating keys and secrets into config.php.
Create an Instagram application
- Sign in with Instagram Developer
- Click "Register Your Application" (this is a button, click it).
- Create a New Application. Enter a name (this is for your reference), a description (again for your reference), your site's URL, and the url for the directory
instagram
where your app will live for the redirect uri. - Create my Access Token (this is a button, click it)
- View the details tab. Copy and paste the correlating keys and secrets into config.php.
- Upload the app to your sever and navigate to the instagram directory from your browser.
- Authenticate your app.
- Copy and paste the value for the access token into the access token for instagram field in config.php.
Recommendations
Since this is using a work around for what will eventually be replaced by the Vine API, I would suggest using a cron job for the update()
function and only calling from the database when a visitor hits the server. This should reduce load time and make sure the server is not over worked.
Build Instructions
This project uses Grunt to automate build tasks (eg. compile less and minimize js).
- Install Node.js
- Install grunt-cli:
npm install -g grunt-cli
- Install dev dependencies:
npm install
- Run
grunt
to compile, orgrunt server
to start a live development environment.