<s> import urllib <EOL> import urllib2 <EOL> import json <EOL> import os <EOL> import sys <EOL> inputphrase = os . environ [ '<STR_LIT>' ] <EOL> markdown = os . environ [ '<STR_LIT>' ] [ : <NUM_LIT:1> ] == '<STR_LIT:M>' <EOL> terms = urllib . quote_plus ( inputphrase . strip ( ) ) <EOL> url = "<STR_LIT>" + terms <EOL> data = urllib2 . urlopen ( url ) . read ( ) <EOL> link = json . loads ( data ) [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ; <EOL> if markdown : <EOL> output = "<STR_LIT:[>" + inputphrase + "<STR_LIT>" + link + "<STR_LIT:)>" <EOL> else : <EOL> output = link <EOL> sys . stdout . write ( output ) </s>
