{"id":1119,"date":"2009-02-05T08:30:10","date_gmt":"2009-02-05T16:30:10","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/2009\/02\/05\/get-tweetertagged-user\/"},"modified":"2016-10-27T13:56:44","modified_gmt":"2016-10-27T20:56:44","slug":"get-tweetertagged-user","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2009\/02\/05\/get-tweetertagged-user\/","title":{"rendered":"Get TweeterTagged User"},"content":{"rendered":"<p>If you use Twitter and like to script, especially in PowerShell, then I think you&#8217;ll like this. A new site, <a href=\"http:\/\/www.tweetertags.com\" target=\"_blank\">TweeterTags.com<\/a> has launched that allows you to tag your Twitter profile. The upshot is that this makes it easier to discover like-minded individuals. So let&#8217;s say I want to find all the PowerShell tagged users, here&#8217;s how I can do it directly from PowerShell with a simple script.<\/p>\n<div style=\"font-size: 8pt; margin: 20px 0px 10px; overflow: auto; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border: gray 1px solid; padding: 4px;\">\n<div style=\"font-size: 8pt; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># ==============================================================================================<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># <\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 2009<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># <\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># NAME: Get-TweeterTag.ps1<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># <\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># AUTHOR: Jeffery Hicks , SAPIEN Technologies, Inc.<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># DATE  : 2\/5\/2009<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># <\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># COMMENT: Find users by tag from TweeterTags.com <\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># <\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># ==============================================================================================<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">Function Get-TweeterTag {<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"> Param ([string]$tag=<span style=\"color: #006080;\">\"powershell\"<\/span>)<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><span style=\"color: #008000;\">#make sure tag is in lower case<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">$tag=$tag.ToLower()<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">$url=<span style=\"color: #006080;\">\"http:\/\/www.tweetertags.com\/tag\/$tag\/users.xml\"<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><span style=\"color: #008000;\"># Write-Host \"Downloading $url\" -fore yellow<\/span><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">$web=New-Object System.net.WebClient<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">[xml]$users=$web.DownloadString($url)<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">$users.TweeterTagsUsers.User<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">}<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">Write-Host <span style=\"color: #006080;\">\"PowerShell\"<\/span> -ForegroundColor Green<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">Get-TweeterTag | sort Name | select Name,Screen_Name,Description<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">Write-Host `n<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">Write-Host <span style=\"color: #006080;\">\"VMWare\"<\/span> -ForegroundColor Green<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">Get-TweeterTag <span style=\"color: #006080;\">\"VMWare\"<\/span> | sort Name | select Name,Screen_Name,Description<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\"><\/pre>\n<\/div>\n<\/div>\n<p>The script, Get-TweeterTag.ps1, is a wrapper for the Get-TweeterTag function. The function takes a parameter which is the tag you want to search for. It should be passed in lowercase, but the function will convert it to be sure. The default tag is PowerShell.<\/p>\n<p>Then using the System.Net.Webclient object I download the xml file with all the tagged users from the site and save it as an xml document.<\/p>\n<div style=\"font-size: 8pt; margin: 20px 0px 10px; overflow: auto; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border: gray 1px solid; padding: 4px;\">\n<div style=\"font-size: 8pt; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">$web=New-Object System.net.WebClient<\/pre>\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">[xml]$users=$web.DownloadString($url)<\/pre>\n<\/div>\n<\/div>\n<p>The function then writes each user node to the pipeline.<\/p>\n<div style=\"font-size: 8pt; margin: 20px 0px 10px; overflow: auto; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border: gray 1px solid; padding: 4px;\">\n<div style=\"font-size: 8pt; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4; border-style: none; padding: 0px;\">\n<pre style=\"font-size: 8pt; margin: 0em; overflow: visible; width: 100%; color: black; line-height: 12pt; font-family: consolas, 'Courier New', courier, monospace; background-color: white; border-style: none; padding: 0px;\">$users.TweeterTagsUsers.User<\/pre>\n<\/div>\n<\/div>\n<p>This allows me to use the function like this:<\/p>\n<p>Get-TweeterTag | sort Name | select Name,Screen_Name,Description<\/p>\n<p>Get-TweeterTag\u00a0 &#8220;VMWare&#8221; | sort Name | select Name,Screen_Name,Description<\/p>\n<p>You could take this a step further, and I expect people will, to use add users you aren&#8217;t already following.<\/p>\n<p>By the way, this was fun to develop and test in <a href=\"http:\/\/www.primaltools.com\" target=\"_blank\">PrimalScript 2009<\/a>.\u00a0 I could write a PowerShell expression in the editor, then drag and drop it into the integrated command window and have it execute.<\/p>\n<div id=\"scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:6c6e3eca-0289-4b02-b786-5a91cb8074a1\" class=\"wlWriterSmartContent\" style=\"display: inline; margin: 0px; padding: 0px;\">\n<p>Download this script as a text file <a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2009\/02\/get-tweetertag.txt\" target=\"_blank\">here.<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you use Twitter and like to script, especially in PowerShell, then I think you&#8217;ll like this. A new site, TweeterTags.com has launched that allows you to tag your Twitter profile. The upshot is that this makes it easier to discover like-minded individuals. So let&#8217;s say I want to find all the PowerShell tagged users, here&#8217;s how I can do it directly from PowerShell with a simple script.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[25],"tags":[198,28,447,446,185,448,197],"class_list":["post-1119","post","type-post","status-publish","format-standard","hentry","category-windows-powershell","tag-function","tag-powershell","tag-script","tag-tweettags","tag-twitter","tag-web","tag-xml"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/1119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=1119"}],"version-history":[{"count":1,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/1119\/revisions"}],"predecessor-version":[{"id":12769,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/1119\/revisions\/12769"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=1119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=1119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=1119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}