{"id":3293,"date":"2016-07-12T21:15:02","date_gmt":"2016-07-12T20:15:02","guid":{"rendered":"https:\/\/blog.christiaan008.com\/?p=3293"},"modified":"2016-07-12T21:15:02","modified_gmt":"2016-07-12T20:15:02","slug":"retrieving-flickr-photo-views-using-shell-scripting","status":"publish","type":"post","link":"https:\/\/blog.christiaan008.com\/?p=3293","title":{"rendered":"Retrieving Flickr photo views using shell scripting"},"content":{"rendered":"<p>[et_pb_section admin_label=&#8221;section&#8221; background_image=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/07\/flickr_api_code_darker_adjusted.jpg&#8221; transparent_background=&#8221;off&#8221; background_color=&#8221;rgba(0,0,0,0.19)&#8221; allow_player_pause=&#8221;off&#8221; inner_shadow=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; padding_mobile=&#8221;off&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; make_equal=&#8221;off&#8221; use_custom_gutter=&#8221;off&#8221;][et_pb_row admin_label=&#8221;row&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#ffffff&#8221; show_divider=&#8221;off&#8221; height=&#8221;200&#8243; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; hide_on_mobile=&#8221;on&#8221;] [\/et_pb_divider][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;72&#8243; text_text_color=&#8221;#ffffff&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;0px||0px|&#8221; text_line_height=&#8221;1.1em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221; text_font_size_tablet=&#8221;52&#8243;] Retrieving\u00a0Flickr photo views using shell scripting [\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section admin_label=&#8221;Section&#8221; fullwidth=&#8221;off&#8221; specialty=&#8221;off&#8221; transparent_background=&#8221;off&#8221; background_color=&#8221;#f7f7f4&#8243; allow_player_pause=&#8221;off&#8221; inner_shadow=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; padding_mobile=&#8221;off&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; make_equal=&#8221;off&#8221; use_custom_gutter=&#8221;off&#8221;][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;off&#8221; custom_padding=&#8221;0px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221;][et_pb_column type=&#8221;1_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;10em&#8221; text_text_color=&#8221;#323232&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_line_height=&#8221;1.1em&#8221; custom_margin=&#8221;0px||0px|&#8221;]<\/p>\n<p>12<\/p>\n<p>[\/et_pb_text][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#aeaeac&#8221; show_divider=&#8221;on&#8221; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; hide_on_mobile=&#8221;off&#8221; custom_css_main_element=&#8221;width:20px;&#8221;] [\/et_pb_divider][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;18&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;-10px||0px|&#8221;] JULY, 2016 [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Sans||||&#8221; text_text_color=&#8221;#02b875&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;20px|||&#8221;] <a href=\"https:\/\/blog.christiaan008.com\/category\/scripting\/\">Scripting<\/a> [\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;10px||0px|&#8221; text_line_height=&#8221;1.4em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221;] Thousands of websites are already using the photos I&#8217;m sharing on the Flickr platform. Time to create a script that retrieves the daily views! [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; text_line_height=&#8221;1.5em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221;]<\/p>\n<p>Currently I&#8217;m working on an update for Christiaan&#8217;s Collection. Some time ago I started to take photos\u00a0for the website and uploading them under <a href=\"https:\/\/creativecommons.org\" target=\"_blank\">Creative Commons license<\/a> to the\u00a0<a href=\"https:\/\/www.flickr.com\/photos\/132889348@N07\/\" target=\"_blank\">Flickr<\/a> platform so other people can use them for free.<\/p>\n<p>During the last couple of months the photos are used on websites, in presentations and as banners. The amount of views are rising on the Flickr platform. If you have a Flickr pro account you can track the views easily, but in this case I just created a shell script\u00a0myself that tracks the amount of views for me. The script can be found on the <a href=\"https:\/\/wiki.christiaan008.com\/index.php\/Retrieving_Flickr_photo_views_using_shell_scripting\" target=\"_blank\">wiki<\/a>.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;off&#8221; custom_padding=&#8221;50px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; custom_padding_tablet=&#8221;17px|||&#8221; custom_padding_last_edited=&#8221;on|tablet&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code10_hd.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;on&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;16&#8243; text_line_height=&#8221;1em&#8221; custom_margin=&#8221;20px||0px|&#8221;] Shell script on an iPhone [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;12&#8243; text_line_height=&#8221;1.2em&#8221; custom_margin=&#8221;6px|||&#8221;] Photograph by Christiaan Colen available on <a href=\"https:\/\/www.flickr.com\/photos\/132889348@N07\/27635346540\/in\/datetaken\/\" target=\"_blank\">Flickr<\/a> [\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;off&#8221; custom_padding=&#8221;0px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; text_line_height=&#8221;1.5em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221;]<\/p>\n<p>The shell script is a basic script that uses the Flickr <a href=\"https:\/\/en.wikipedia.org\/wiki\/Application_programming_interface\" target=\"_blank\">API<\/a> to retrieve the views of all the photos from your account.\u00a0It does this by a simple web request to the <a href=\"https:\/\/www.flickr.com\/services\/api\/\" target=\"_blank\">Flickr API<\/a> using the &#8216;curl&#8217; program. It uses your <a href=\"https:\/\/www.flickr.com\/services\/api\/misc.api_keys.html\" target=\"_blank\">Flickr API key<\/a> that you can generate via the website and your user ID to get all the ID&#8217;s (for example &#8216;27635346150&#8217;) of your photos. The code below is an example of this request.<\/p>\n<pre>ids=$(curl -s \"https:\/\/api.flickr.com\/services\/rest\/?method=flickr.people.getPhotos&amp;api_key=\"$KEY\"&amp;user_id=\"$user\"&amp;per_page=500&amp;format=rest\" | grep -o -P '(?&lt;=photo id=\").*(?=\" owner=)')<\/pre>\n<p>This script retrieves a maximum of 500 photo ID&#8217;s, if there are more then 500 photos it will take the 500 latest photos. It&#8217;s easy to add a couple of lines of code to retrieve more later on.<\/p>\n<p>After getting all the photo ID&#8217;s they are read into an <a href=\"http:\/\/www.tutorialspoint.com\/unix\/unix-using-arrays.htm\" target=\"_blank\">array<\/a>, a group of values into one variable. \u00a0I&#8217;m calling this variable the &#8216;idsarray&#8217;.<br \/>\nThe &#8216;idsarray&#8217; looks something like this:\u00a0[position 0] 27610919906\u00a0[position 1] 27610920016\u00a0[position 2] 27610920076 and so on.<\/p>\n<p>This makes it easy to iterate through all the values.\u00a0The code below is an example of reading the output from the previous step into the array.<\/p>\n<pre>read -r -a idsarray &lt;&lt;&lt; $ids<\/pre>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;off&#8221; custom_padding=&#8221;50px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#aeaeac&#8221; show_divider=&#8221;on&#8221; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; hide_on_mobile=&#8221;off&#8221;] [\/et_pb_divider][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;48&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;16px||30px|&#8221; text_line_height=&#8221;1.3em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221; text_font_size_tablet=&#8221;38&#8243; max_width=&#8221;900px&#8221;]<\/p>\n<p>The measure of who we are is what we do with what we have &#8211;\u00a0Vince Lombardi<\/p>\n<p>[\/et_pb_text][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#aeaeac&#8221; show_divider=&#8221;on&#8221; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; hide_on_mobile=&#8221;off&#8221;] [\/et_pb_divider][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;off&#8221; custom_padding=&#8221;17px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; text_line_height=&#8221;1.5em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221;]<\/p>\n<p>The next part of the script\u00a0is the for loop which iterates through all the photo ID&#8217;s in the &#8216;idsarray&#8217;. I&#8217;m using the variable &#8216;${idsarray[@]}&#8217; to iterate through the whole array. By using the &#8216;@&#8217; the for loop iterates through the whole array instead of one entry. Per photo ID the loop sends a request to the Flickr API for all the photo information.\u00a0From this output the script only takes the title of the photo and the views.<\/p>\n<p>[\/et_pb_text][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_for_loop.png&#8221; show_in_lightbox=&#8221;on&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; max_width=&#8221;600px&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;5%||5%|&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; text_line_height=&#8221;1.5em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221;]<\/p>\n<p>The script reads the values of the text file from yesterday into the variable &#8216;photoviewsyesterday&#8217; to determine the views from the day before. The code below is an example:<\/p>\n<pre>photoviewsyesterday=$(cat $path$filedateyesterday | grep \"$id\" | cut -d '|' -f 4)<\/pre>\n<p>The &#8216;$path&#8217; and &#8216;$filedateyesterday&#8217; are values that are already determined in the script. The &#8216;$id&#8217; variable contains\u00a0the current photo ID from the for loop. I&#8217;m using the &#8216;|&#8217; sign to split values when I write output to a text file, the &#8216;cut&#8217; command takes this as delimiter and takes field number 4 because that&#8217;s the position I&#8217;m storing the views in a text file.<\/p>\n<p>Afterwards it determines the difference between the views from today and yesterday and stores it in the variable &#8216;photoviewsdifference&#8217;.<\/p>\n<pre>photoviewsdifference=`expr $views - $photoviewsyesterday`<\/pre>\n<p>The &#8216;expr&#8217; command is used to create an expression in other words, makes it possible to do mathematics.<\/p>\n<p>Today&#8217;s date, the photo ID, the photo title, the current views and difference between yesterdays views and today&#8217;s views are written to a text file.\u00a0The current views are also added to the variable &#8216;totalviews&#8217; to keep track of the total amount of views for today.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;2&#8243; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; custom_padding=&#8221;50px|||&#8221; custom_padding_tablet=&#8221;30px|||&#8221; custom_padding_last_edited=&#8221;on|tablet&#8221;][et_pb_column type=&#8221;1_2&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code12_hd.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;] [\/et_pb_image][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code3_hd.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;34px|||&#8221;] [\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;1_2&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code6_hd.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;] [\/et_pb_image][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code1_hd.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;34px|||&#8221;] [\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;off&#8221; custom_padding=&#8221;17px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221;][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/screenshot_flickr_stats_script.jpg&#8221; show_in_lightbox=&#8221;on&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;left&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;off&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; max_width=&#8221;140px&#8221; custom_margin=&#8221;36px||0px|&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;16&#8243; text_line_height=&#8221;1.1em&#8221; custom_margin=&#8221;16px||0px|&#8221; max_width=&#8221;140px&#8221;] The Flickr API script. [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;12&#8243; text_line_height=&#8221;1.2em&#8221; custom_margin=&#8221;6px|||&#8221; max_width=&#8221;140px&#8221;] Photographs by Christiaan Colen available on\u00a0<a href=\"https:\/\/www.flickr.com\/photos\/132889348@N07\/\" target=\"_blank\"><span style=\"color: #02ab6b;\">Flickr<\/span><\/a> [\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; text_line_height=&#8221;1.5em&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221;]<\/p>\n<p>After the for loop iterates through all the photo ID&#8217;s, the script calculates the difference between the total amount of views from yesterday and today. The script writes today&#8217;s date, total amount of views and the calculated difference between the total amount of views to another text file.<\/p>\n<p>This basic functionality of the script is enough for me for now. In the future it&#8217;s quite easy to put all the data in a MySQL database and use for example <a href=\"http:\/\/www.highcharts.com\" target=\"_blank\">Highcharts<\/a> to create your own charts. Also adding a couple of lines to create an archive directory or error messages if something fails is for now not necessary.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section admin_label=&#8221;Section&#8221; fullwidth=&#8221;off&#8221; specialty=&#8221;off&#8221;][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;on&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;780px&#8221; use_custom_gutter=&#8221;off&#8221; padding_mobile=&#8221;off&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;36&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.4em&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_font_size_tablet=&#8221;26&#8243; text_font_size_last_edited=&#8221;on|tablet&#8221; custom_margin=&#8221;||70px|&#8221;]<\/p>\n<p>Music videos of the day<\/p>\n<p>[\/et_pb_text][et_pb_video_slider admin_label=&#8221;Video Slider&#8221; show_image_overlay=&#8221;hide&#8221; show_arrows=&#8221;on&#8221; show_thumbnails=&#8221;off&#8221; controls_color=&#8221;dark&#8221;] [et_pb_video_slider_item src=&#8221;https:\/\/www.youtube.com\/watch?v=9gJeVEhcFR8&#8243; image_src=&#8221;\/\/i.ytimg.com\/vi\/9gJeVEhcFR8\/hqdefault.jpg&#8221; background_layout=&#8221;dark&#8221; \/][et_pb_video_slider_item src=&#8221;https:\/\/www.youtube.com\/watch?v=yVhzKSGH2As&#8221; image_src=&#8221;\/\/i.ytimg.com\/vi\/yVhzKSGH2As\/hqdefault.jpg&#8221; background_layout=&#8221;dark&#8221; \/][et_pb_video_slider_item src=&#8221;https:\/\/www.youtube.com\/watch?v=T4PBuLuysQM&#8221; image_src=&#8221;\/\/i.ytimg.com\/vi\/T4PBuLuysQM\/hqdefault.jpg&#8221; background_layout=&#8221;dark&#8221; \/] [\/et_pb_video_slider][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section admin_label=&#8221;Section&#8221; fullwidth=&#8221;off&#8221; specialty=&#8221;off&#8221; transparent_background=&#8221;off&#8221; background_color=&#8221;#222222&#8243; allow_player_pause=&#8221;off&#8221; inner_shadow=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; padding_mobile=&#8221;on&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; make_equal=&#8221;off&#8221; use_custom_gutter=&#8221;off&#8221; custom_padding=&#8221;0px||0px|&#8221; custom_padding_last_edited=&#8221;off|phone&#8221;][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;on&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;2&#8243; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; custom_padding=&#8221;40px|||&#8221;][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2015\/11\/shell_script1_high.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;on&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; url=&#8221;https:\/\/blog.christiaan008.com\/2015\/11\/08\/dynamically-splitting-output-into-files-while-processing\/&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#888888&#8243; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_letter_spacing=&#8221;2px&#8221; custom_margin=&#8221;30px|||&#8221;] <a href=\"https:\/\/blog.christiaan008.com\/category\/scripting\/\" target=\"_blank\">SCRIPTING<\/a> [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#ffffff&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;]<\/p>\n<p><a href=\"https:\/\/blog.christiaan008.com\/2015\/11\/08\/dynamically-splitting-output-into-files-while-processing\/\"><span style=\"color: #ffffff;\">Dynamically splitting output into <\/span><\/a><br \/>\n<span style=\"color: #ffffff;\">files while processing<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/07\/christiaans_collection_video_wall_1920_1080.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; url=&#8221;https:\/\/blog.christiaan008.com\/2015\/03\/08\/updating-christiaans-collection\/&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#888888&#8243; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_letter_spacing=&#8221;2px&#8221; custom_margin=&#8221;30px|||&#8221;] <a href=\"https:\/\/blog.christiaan008.com\/category\/design\/\">DESIGN<\/a> [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#ffffff&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;]<\/p>\n<p><a href=\"https:\/\/blog.christiaan008.com\/2015\/03\/08\/updating-christiaans-collection\/\"><span style=\"color: #ffffff;\">Updating Christiaan&#8217;s<br \/>\nCollection<\/span><\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2015\/01\/cover.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; url=&#8221;https:\/\/blog.christiaan008.com\/2015\/01\/16\/building-a-pole-for-the-wifi-project\/&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#888888&#8243; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; text_letter_spacing=&#8221;2px&#8221; custom_margin=&#8221;30px|||&#8221;] <a href=\"https:\/\/blog.christiaan008.com\/category\/south-africa\/\" target=\"_blank\">SOUTH AFRICA<\/a> [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#ffffff&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;]<\/p>\n<p><a href=\"https:\/\/blog.christiaan008.com\/2015\/01\/16\/building-a-pole-for-the-wifi-project\/\"><span style=\"color: #ffffff;\">Building a pole for <\/span><\/a><br \/>\n<span style=\"color: #ffffff;\">the WiFi project<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thousands of websites are already using the photos I&#8217;m sharing on the Flickr platform. Time to create a script that retrieves the daily views!<\/p>\n","protected":false},"author":2,"featured_media":3307,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"categories":[43],"tags":[],"class_list":["post-3293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Retrieving Flickr photo views using shell scripting | Christiaan&#039;s blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.christiaan008.com\/?p=3293\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Retrieving Flickr photo views using shell scripting | Christiaan&#039;s blog\" \/>\n<meta property=\"og:description\" content=\"Thousands of websites are already using the photos I&#039;m sharing on the Flickr platform. Time to create a script that retrieves the daily views!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.christiaan008.com\/?p=3293\" \/>\n<meta property=\"og:site_name\" content=\"Christiaan&#039;s blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/christiaan008\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-12T20:15:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code2_hd.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christiaan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@christiaan008\" \/>\n<meta name=\"twitter:site\" content=\"@christiaan008\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christiaan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293\"},\"author\":{\"name\":\"Christiaan\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#\\\/schema\\\/person\\\/80afd7344699708649053651d6583631\"},\"headline\":\"Retrieving Flickr photo views using shell scripting\",\"datePublished\":\"2016-07-12T20:15:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293\"},\"wordCount\":3464,\"image\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/06\\\/flickr_api_code2_hd.jpg\",\"articleSection\":[\"Scripting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293\",\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293\",\"name\":\"Retrieving Flickr photo views using shell scripting | Christiaan&#039;s blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/06\\\/flickr_api_code2_hd.jpg\",\"datePublished\":\"2016-07-12T20:15:02+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#\\\/schema\\\/person\\\/80afd7344699708649053651d6583631\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293#primaryimage\",\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/06\\\/flickr_api_code2_hd.jpg\",\"contentUrl\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/06\\\/flickr_api_code2_hd.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3293#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.christiaan008.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Retrieving Flickr photo views using shell scripting\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#website\",\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/\",\"name\":\"Christiaan&#039;s blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.christiaan008.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#\\\/schema\\\/person\\\/80afd7344699708649053651d6583631\",\"name\":\"Christiaan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g\",\"caption\":\"Christiaan\"},\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Retrieving Flickr photo views using shell scripting | Christiaan&#039;s blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.christiaan008.com\/?p=3293","og_locale":"en_US","og_type":"article","og_title":"Retrieving Flickr photo views using shell scripting | Christiaan&#039;s blog","og_description":"Thousands of websites are already using the photos I'm sharing on the Flickr platform. Time to create a script that retrieves the daily views!","og_url":"https:\/\/blog.christiaan008.com\/?p=3293","og_site_name":"Christiaan&#039;s blog","article_publisher":"https:\/\/www.facebook.com\/christiaan008","article_published_time":"2016-07-12T20:15:02+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code2_hd.jpg","type":"image\/jpeg"}],"author":"Christiaan","twitter_card":"summary_large_image","twitter_creator":"@christiaan008","twitter_site":"@christiaan008","twitter_misc":{"Written by":"Christiaan","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.christiaan008.com\/?p=3293#article","isPartOf":{"@id":"https:\/\/blog.christiaan008.com\/?p=3293"},"author":{"name":"Christiaan","@id":"https:\/\/blog.christiaan008.com\/#\/schema\/person\/80afd7344699708649053651d6583631"},"headline":"Retrieving Flickr photo views using shell scripting","datePublished":"2016-07-12T20:15:02+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.christiaan008.com\/?p=3293"},"wordCount":3464,"image":{"@id":"https:\/\/blog.christiaan008.com\/?p=3293#primaryimage"},"thumbnailUrl":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code2_hd.jpg","articleSection":["Scripting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blog.christiaan008.com\/?p=3293","url":"https:\/\/blog.christiaan008.com\/?p=3293","name":"Retrieving Flickr photo views using shell scripting | Christiaan&#039;s blog","isPartOf":{"@id":"https:\/\/blog.christiaan008.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.christiaan008.com\/?p=3293#primaryimage"},"image":{"@id":"https:\/\/blog.christiaan008.com\/?p=3293#primaryimage"},"thumbnailUrl":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code2_hd.jpg","datePublished":"2016-07-12T20:15:02+00:00","author":{"@id":"https:\/\/blog.christiaan008.com\/#\/schema\/person\/80afd7344699708649053651d6583631"},"breadcrumb":{"@id":"https:\/\/blog.christiaan008.com\/?p=3293#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.christiaan008.com\/?p=3293"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.christiaan008.com\/?p=3293#primaryimage","url":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code2_hd.jpg","contentUrl":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code2_hd.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/blog.christiaan008.com\/?p=3293#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.christiaan008.com\/"},{"@type":"ListItem","position":2,"name":"Retrieving Flickr photo views using shell scripting"}]},{"@type":"WebSite","@id":"https:\/\/blog.christiaan008.com\/#website","url":"https:\/\/blog.christiaan008.com\/","name":"Christiaan&#039;s blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.christiaan008.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.christiaan008.com\/#\/schema\/person\/80afd7344699708649053651d6583631","name":"Christiaan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g","caption":"Christiaan"},"url":"https:\/\/blog.christiaan008.com\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts\/3293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3293"}],"version-history":[{"count":117,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts\/3293\/revisions"}],"predecessor-version":[{"id":3432,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts\/3293\/revisions\/3432"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/media\/3307"}],"wp:attachment":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}