Downloading Twitter photos

Top  Previous  Next

 

Hotfolder Prints comes with a Twitter hashtag monitor program. The program works by logging into Twitter and searching 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 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 texting.

The combination of the Twitter hashtag monitor and Hotfolder Prints provides a fully automated Twitter hashtag printing system. An interactive system which downloads and displays the photos and lets the user choose which photos to print, email or text 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 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 Twitter 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 Twitter hashtag monitors. The layout can be printed automatically or saved as a JPEG image for displaying in a slideshow or touchscreen kiosk.

 

Suggested Hotflolder Print settings for processing Twitter tweets are shown below:

hashtag_hfp_settings

The "Folder to monitor for new images:" should be set to the folder where the Twitter 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.

 

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 a 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. Captions can be 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 Twitter downloads:

{date}

date the photo was tweeted on Twitter e.g. 2020/12/28

{time}

time the photo was posted on 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 Twitter username e.g. johndoe

{full_name}

author's full name e.g. John Doe

{user_id}

author's Twitter user id e.g. 87687656

{caption}

Twitter tweet text e.g. Great party! #wedding20150115

{captionNoURL}

Twitter tweet text with the trailing URL removed

{hashtag}

the search hashtag

{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 tweets). Some example URLs are given below:

 

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

https://twitter/{user_id}