SYS-CON MEDIA Authors: Liz McMillan, Yeshim Deniz, Elizabeth White, William Schmarzo, Dana Gardner

Blog Feed Post

Introducing PoshBing – The PowerShell library for Microsoft’s Bing Search Engine

PoshBing Microsoft released their new search engine called “Bing” at, aptly named, http://www.bing.com.  Microsoft is getting positive reviews from the likes of CNET, The Wall Street Journal, and TechCrunch.  Instead of posting my review of the site, I’ll let you browse the above links to find out what the services is all about.

What interested me about Bing is that Microsoft has released a full API to allow you to use their services in your applications.  The Bing API is documented at Microsoft’s developer site and I thought to myself how I could test it out.  The obvious answer was PowerShell of course.  My previous PoshTweet Twitter Library has been fairly popular so I figured I’d give a “library” type project another go around and tackle the Bing APIs.

The Bing API has the concept of “SourceTypes” which are essentially data sources that you can search into.  My script library provides access to the Image, InstantAnswer, News, MobileWeb, Phonebook, RelatedSearch, Spell, Web, Translation, and Video SourceTypes with the following functions:

  • Get-BingImage – Search the Image SourceType for a list of images including properties about the media files.
  • Get-BingInstantAnswer – Get single, authoritative answers to questions.
  • Get-BingNews – Provide news specific to a topic, a location, or breaking news.
  • Get-BingMobileWeb – Returns mobile web results, primarily relevant XHTML or WML pages.
  • Get-BingPhonebook – Enables you to view details about a business for which you are searching as if they were a phonebook entry.
  • Get-BingRelatedSearch – View searches that provide information in which you might be interested, based on your current search.
  • Get-BingSpell – Query alternative spellings for a given word or phrase.
  • Get-BingWeb – Get pages relevant to the queried terms.
  • Get-BingTranslation – Translate a term from one language to another.
  • Get-BingVideo – return a list of videos and their properties relevant to the query terms.

I’ve included parsing for the response streams for the above SourceTypes, but if you would like to get the raw XML back, all of the above functions include a “-raw” parameter to allow you to bypass the response processing.

Here’s the full function library, enjoy!

CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0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F7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
CRLF9
CRLF8
CRLF7
CRLF6
CRLF5
CRLF4
CRLF3
CRLF2
CRLF1
CRLF0
 799:   else
 800:   {
 801:     $options_hash = @{
 802:       "Translation.SourceLanguage" = $translation_sourcelanguage;
 803:       "Translation.TargetLanguage" = $translation_targetlanguage;
 804:     };
 805:     
 806:     $xml = Get-Bing -query $query -sources "Translation" `
 807:       -options_hash $options_hash -common_hash $common_hash;
 808:     if ( $raw )
 809:     {
 810:       $xml
 811:     }
 812:     else
 813:     {
 814:       Process-BingResponse $xml;
 815:     }
 816:   }
 817: }
 818:  
 819: #============================================================================
 820: # Video (2.1)
 821: #============================================================================
 822: function Get-BingVideo()
 823: {
 824:   param(
 825:     [string]$query = $null,
 826:     [int]$video_count = 2,
 827:     [int]$video_offset = 0,
 828:     [bool]$raw = $false
 829:   );
 830:   
 831:   $common_hash = Get-CommonFieldHash;
 832:   $common_hash["Version"] = "2.1";
 833:   
 834:   $options_hash = @{
 835:     "Video.Count" = $video_count;
 836:     "Video.Offset" = $video_offset;
 837:   };
 838:   
 839:   $xml = Get-Bing -query $query -sources "Video" `
 840:     -options_hash $options_hash -common_hash $common_hash;
 841:   if ( $raw )
 842:   {
 843:     $xml
 844:   }
 845:   else
 846:   {
 847:     Process-BingResponse $xml;
 848:   }
 849: }

You can download the full script from here: PoshBing.ps1

Read the original blog entry...

More Stories By Joe Pruitt

Joe Pruitt is a Principal Strategic Architect at F5 Networks working with Network and Software Architects to allow them to build network intelligence into their applications.

Latest Stories
Eric Taylor, a former hacker, reveals what he's learned about cybersecurity. Taylor's life as a hacker began when he was just 12 years old and playing video games at home. Russian hackers are notorious for their hacking skills, but one American says he hacked a Russian cyber gang at just 15 years old. The government eventually caught up with Taylor and he pleaded guilty to posting the personal information on the internet, among other charges. Eric Taylor, who went by the nickname Cosmo...
Most modern computer languages embed a lot of metadata in their application. We show how this goldmine of data from a runtime environment like production or staging can be used to increase profits. Adi conceptualized the Crosscode platform after spending over 25 years working for large enterprise companies like HP, Cisco, IBM, UHG and personally experiencing the challenges that prevent companies from quickly making changes to their technology, due to the complexity of their enterprise. An accomp...
DevOpsSUMMIT at CloudEXPO, to be held June 25-26, 2019 at the Santa Clara Convention Center in Santa Clara, CA – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Am...
The benefits of automated cloud deployments for speed, reliability and security are undeniable. The cornerstone of this approach, immutable deployment, promotes the idea of continuously rolling safe, stable images instead of trying to keep up with managing a fixed pool of virtual or physical machines. In this talk, we'll explore the immutable infrastructure pattern and how to use continuous deployment and continuous integration (CI/CD) process to build and manage server images for any platfo...
Nicolas Fierro is CEO of MIMIR Blockchain Solutions. He is a programmer, technologist, and operations dev who has worked with Ethereum and blockchain since 2014. His knowledge in blockchain dates to when he performed dev ops services to the Ethereum Foundation as one the privileged few developers to work with the original core team in Switzerland.
It cannot be overseen or regulated by any one administrator, like a government or bank. Currently, there is no government regulation on them which also means there is no government safeguards over them. Although many are looking at Bitcoin to put money into, it would be wise to proceed with caution. Regular central banks are watching it and deciding whether or not to make them illegal (Criminalize them) and therefore make them worthless and eliminate them as competition. ICOs (Initial Coin Offer...
Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
The current environment of Continuous Disruption requires companies to transform how they work and how they engineer their products. Transformations are notoriously hard to execute, yet many companies have succeeded. What can we learn from them? Can we produce a blueprint for a transformation? This presentation will cover several distinct approaches that companies take to achieve transformation. Each approach utilizes different levers and comes with its own advantages, tradeoffs, costs, risks, a...
Organize your corporate travel faster, at lower cost. Hotailors is a next-gen AI-powered travel platform. What is Hotailors? Hotailors is a platform for organising business travels that grants access to the best real-time offers from 2.000.000+ hotels and 700+ airlines in the whole world. Thanks to our solution you can plan, book & expense business trips in less than 5 minutes. Accordingly to your travel policy, budget limits and cashless for your employees. With our reporting, int...
This sixteen (16) hour course provides an introduction to DevOps, the cultural and professional movement that stresses communication, collaboration, integration and automation in order to improve the flow of work between software developers and IT operations professionals. Improved workflows will result in an improved ability to design, develop, deploy and operate software and services faster.
Enterprises are universally struggling to understand where the new tools and methodologies of DevOps fit into their organizations, and are universally making the same mistakes. These mistakes are not unavoidable, and in fact, avoiding them gifts an organization with sustained competitive advantage, just like it did for Japanese Manufacturing Post WWII.
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
There's no doubt that blockchain technology is a powerful tool for the enterprise, but bringing it mainstream has not been without challenges. As VP of Technology at 8base, Andrei is working to make developing a blockchain application accessible to anyone. With better tools, entrepreneurs and developers can work together to quickly and effectively launch applications that integrate smart contracts and blockchain technology. This will ultimately accelerate blockchain adoption on a global scale.
DXWorldEXPO LLC announced today that Nutanix has been named "Platinum Sponsor" of CloudEXPO | DevOpsSUMMIT | DXWorldEXPO New York, which will take place November 12-13, 2018 in New York City. Nutanix makes infrastructure invisible, elevating IT to focus on the applications and services that power their business. The Nutanix Enterprise Cloud Platform blends web-scale engineering and consumer-grade design to natively converge server, storage, virtualization and networking into a resilient, softwar...