Downloading Instagram and Twitter photos

Top  Previous  Next

 

Hotfolder Prints comes with an Instagram hashtag monitor program and a Twitter hashtag monitor program. Both programs work in a similar way: they login to Instagram or Twitter and search for posts or tweets that match a particular hashtag. When a matching post or tweet is found the photo is downloaded to the PC together with the profile picture and an XML summary file containing information such as the username, date and time of the post or tweet and the caption. This information can then be processed automatically by Hotfolder Prints to create a page showing the Instagram or Twitter posting which can be printed automatically or saved as a JPEG image for viewing in a slideshow using Breeze Viewer or in kiosk software (such as our Breeze Kiosk software) for printing, emailing or uploading to Facebook.

The combination of the Instagram and Twitter hashtag monitors and Hotfolder Prints provides a fully automated Instagram or Twitter hashtag printing sytem. An interactive system which downloads and displays the photos and lets the user choose which photos to print, email or upload to Facebook can be created by adding our Breeze Kiosk software.

Please note: Breeze Kiosk is a separate product which can be purchased from our website: www.breezesys.com/BreezeKiosk

 

 

Running the Instagram Hashtag Monitor

 

Double click on the Hashtag Monitor program icon on the Windows desktop to display the program settings:

hashtag_main

 

Enter the hashtag to monitor in the "Hashtag:" field (the hashtag can be specified with or without the #).

 

Enter the location where the photos should be saved in the "Download folder:" field. This can include tokens for the hashtag or date e.g. to download photos into a folder named using the today's date and the hashtag you could set it to something like:

d:\instagram\%d_{hashtag}

Please see the section on tokens for a list of date related tokens.

 

Set the maximum age in hours for downloaded photos. Only photos with a creation time less than this value will be downloaded.

If the maximum age is set to 0 all photos with the hashtag will be downloaded. Please take care selecting the hashtag when setting this to 0 as a generic hashtag such as #sunset could result in a very large number of photos being downloaded.

 

Press the "Start" button to start downloading images:

 

hashtag_downloading.

 

Click on the "Exit" button or the window's close button to exit Hashtag Monitor.

 

Hashtag monitor can also be run using a desktop shortcut or a script with command line arguments to specify the settings. If the command line specifies both the username and the password Hashtag will login automatically to Instagram and start downloading photos. The following command line arguments can be used:

 

-t<hashtag>

the hashtag to monitor

-a<n>

the maximum age in hours for downloaded photos

-d<folder>

the download folder

 

For example to download photos up to one hour old with the hashtag #wppi2015 to the folder D:\instagram the command line would be something like:

"C:\Program Files (x86)\BreezeSys\Hotfolder Prints\HashtagMonitor.exe" -twppi2015 -a1 -dD:\instagram

 

 

Running the Twitter Hashtag Monitor

 

Double click on the Twitter Hashtag Monitor program icon on the Windows desktop to display the program settings:

 

twitter_main
 

You can either enter your Twitter username and password here or enter them later when the Twitter login screen is displayed. If you enter them here they will be saved with the other settings and loaded the next time Twitter Hashtag Monitor is run. Leave the "Twitter username:" and "Twitter password:" fields empty If you do not wish your Twitter username and password to be saved.

 

Enter the hashtag to monitor in the "Hashtag:" field (the hashtag can be specified with or without the #).

 

Enter the location where the photos should be saved in the "Download folder:" field. This can include tokens for the hashtag or date e.g. to download photos into a folder named using the today's date and the hashtag you could set it to something like:

D:\Twitter\%d_{hashtag}

Please see the section on tokens for a list of date related tokens.

 

Set the maximum age in hours for downloaded photos. Only photos with a creation time less than this value will be downloaded.

If the maximum age is set to 0 all the "recent and popular" photos with the hashtag will be downloaded. Please note that the Twitter search API will only tweets that are "recent and popular" over the last 24 hours or so and may not return all tweets using the given hashtag. Once it has downloaded all the old tweets returned by the Twitter's search API the hashtag monitor will check for new tweets using hte "Polling interval (sec):".

 

Many tweets on Twitter are re-tweets and this can result in the same photo being downloaded multiple times. Set "Ignore re-tweets" to avoid this.

 

Press the "Log in" button to start the download process. This will open a window with the Twitter login screen:

 

twitter_login

 

Enter your Twitter username and password if you haven't already done so and click on the "Sign in" button to login to Twitter and authorise the PhotoHashtagMonitor to download tweets using your account. After logging in the Twitter Hashtag Monitor will start scanning Twitter for tweets containing the search hashtag and a photo:

twitter_downloading

 

Click on the "Exit" button or the window's close button to exit Twitter Hashtag Monitor.

 

 

What is downloaded

 

When the Instagram Hashtag Monitor finds a photo that matches the hashtag and maximum age settings it downloads the photo to the download folder and also the author's profile picture to a subfolder named profile_picture if it hasn't already been downloaded. Hashtag monitor also creates an XML file in the download folder with the information about the posting. The photo is given the same filename as the Instagram image id and the profile picture is named using the user id. The XML information file is given the same filename as the photo (but with a .xml file extension).

e.g. the posting 667547291989582885_233125897 downloaded to D:\Instagram would result in the following three files being created:

D:\Instagram\667547291989582885_233125897.jpg

D:\Instagram\667547291989582885_233125897.xml

D:\Instagram\profile_picture\233125897.jpg

 

The XML information file has the following format

<?xml version="1.0"?>

<breeze_systems_photobooth version="2.0">

       <instagram_photo_information>

               <time_t>1393797849</time_t>

               <date>2014/03/02</date>

               <time>22:04:09</time>

               <photo>667547291989582885_233125897.jpg</photo>

               <caption>Having fun at #wppi2015</caption>

               <user_id>233125897</user_id>

               <username>someone</username>

               <full_name>Full username</full_name>

               <profile_picture>profile_picture\233125897.jpg</profile_picture>

       </instagram_photo_information>

</breeze_systems_photobooth>

 

 
When the ITwitter Hashtag Monitor finds a tweet that matches the hashtag, contains a photo and matches maximum age and re-tweet settings it downloads the photo to the download folder and also the author's profile picture to a subfolder named profile_picture if it hasn't already been downloaded. Twitter hashtag monitor also creates an XML file in the download folder with the information about the posting. The photo is given the same filename as the Twitter tweet id and the profile picture is named using the user id. The XML information file is given the same filename as the photo (but with a .xml file extension).

e.g. the posting 647453302949746688_2783113695 downloaded to D:\Twitter would result in the following three files being created:

D:\Twitter\647453302949746688_2783113695.jpg

D:\Twitter\647453302949746688_2783113695.xml

D:\Twitter\profile_picture\2783113695.jpg

 

The XML information file has the following format:

 

<?xml version="1.0" encoding="UTF-8"?>

<breeze_systems_photobooth version="2.0">

       <twitter_photo_information>

               <time_t>1443199799</time_t>

               <date>2015/09/25</date>

               <time>17:49:59</time>

               <created_at>Fri Sep 25 16:49:59 +0000 2015</created_at>

               <photo>647453302949746688_2783173695.jpg</photo>

               <caption>The tweet text</caption>

               <user_id>2783113695</user_id>

               <post_id>647453302949746688</post_id>

               <username>jdoe123</username>

               <full_name>John Doe</full_name>

               <hashtag>photobooth</hashtag>

               <profile_picture>profile_picture/2783173695.jpeg</profile_picture>

       </twitter_photo_information>

</breeze_systems_photobooth>

 
 

Using Hotfolder Prints to format the photos

 

Hotfolder Prints can be setup to automatically format the photos downloaded by the Instagram hashtag or Twitter hashtag monitors. The layout can be printed automatically or saved as a JPEG image for displaying in a slideshow or touchscreen kiosk.

 

The information downloaded from Instagram or Twitter is very similar and so the same layout could be used for both. Suggested Hotflolder Print settings for processing Instagram photos or Twitter tweets are shown below:

hashtag_hfp_settings

The "Folder to monitor for new images:" should be set to the folder where Hashtag Monitor downloads the photos.

 

The number of images should be set to 2 to allow print layouts with both the photo and the author's profile picture.

 

The "Processing mode:" must be set to "Wait for XML file" so that Hotfolder Prints can read the posting information.

 

The "Filename prefix:" should be set to a value which gives unique filenames for the JPEG copy of the printed output e.g. %d_%t_{user_id} which uses the date, time and user id to name the file.

 

It is recommended that the "Don't process files if output file already exists" option is selected. This will allow the File->Rescan XML files option to be used without duplicate copies of the output files being created. This is useful if Hotfolder Prints is run after Hashtag Monitor has downloaded the images.

 

Until recently Instagram photos had to be square and so the "Photo aspect ratio:" setting should be set to "1:1". Make sure the "Crop image to fill photo area" option is not selected so that if the Instagram photo is not square it will be resized to fit the layout and not cropped to fill the defined area for the photo.

 

Next select the "Custom layout" option and click on the "Settings..." button to create the print layout. The settings below show a layout for 6x4 prints made using a 300dpi dyesub printer:

 

hashtag_6x4_layout

When designing an Instagram or Twitter print layout image 1 represents the photo and image 2 represents the author's profile picture. The layout above also includes a QR code which can be scanned by a smart phone to access a web page (this is covered in more detail latter).

 

Two captions are defined in the layout above. The first caption uses the {username}, {date} and {time} tokens to print the author's username and that date and time the photo was posted. The tokens are replaced with values for the photo being processed. The second caption uses the {caption} token to display the photo's caption. Instagram captions can be very long and so the "Line word wrap" and "Maximum number of lines" settings are used make sure the caption fits the page:

hashtag_caption

The following tokens can be used to in captions and QR codes from Instagram or Twitter downloads:

{date}

date the photo was posted on Instagram or tweeted on Twitter e.g. 2014/12/28

{time}

time the photo was posted on Instagram or tweeted on Twitter e.g. 22:05:29

{photo}

filename of the photo e.g. 162876187264876_87687656.jpg

{photo_id}

id of the photo e.g. 162876187264876_87687656

{username}

author's Instagram or Twitter username e.g. johndoe

{full_name}

author's full name e.g. John Doe

{user_id}

author's Instagram or Twitter user id e.g. 87687656

{caption}

Instagram photo caption or Twitter tweet text e.g. Great party! #wedding20150115

{hashtag}

the search hashtag

{instagram}

1 if this is an Instagram photo else empty

{twitter}

1 if this is a Twitter tweet else empty

 

You can also use the tokens on this page.

 

The example layout above includes a QR code which can be defined using a fixed URL (e.g. a link to your website or your client's website) or a dynamically generated URL (e.g. a date based link a photo gallery on your website or links to display the author's other photos on Instagram). Some example URLs are given below:

 

URLs for QR codes to display the author's other Instagram photos:

https://instagram.com/{username}

http://websta.me/n/{username}

http://iconosquare.com/viewer.php#/user/{user_id}

 

URLs for QR codes to display a particular Instagram photo:

http://websta.me/p/{photo_id}

http://iconosquare.com/viewer.php#/detail/{photo_id}

 

URL for QR codes to display the author's other tweets:

https://twitter/{user_id}

 

You can also use more complicated strings e.g. the following string returns a link to the user's other photos if the download is from Instagram otherwise it returns a link to the user's other tweets on Twitter:

{if,{instagram},https://instagram.com/{username},https://twitter.com/{user_id}}