99+ results for 'api.duckduckgo.com' (0 ms)

Not the results you expected?

answer.lua (https://github.com/wrxck/mattata.git) Lua · 57 lines

14 answer.commands = mattata.commands(self.info.username):command('answer').table

15 answer.help = '/answer <query> - Provides a quick answer to the given query. Results provided by DuckDuckGo.'

16 answer.url = 'https://api.duckduckgo.com/?format=json&pretty=0&q='

17 end

18

gigahorse-030.md (https://github.com/eed3si9n/eed3si9n.com.git) Markdown · 63 lines

40

41 ```scala

42 scala> val r = Gigahorse.url("http://api.duckduckgo.com").get.

43 | addQueryString(

44 | "q" -> "1 + 1",

45 | "format" -> "json"

46 | )

47 r: gigahorse.Request = Request(http://api.duckduckgo.com, GET, EmptyBody(), Map(), Map(q -> List(1 + 1), format -> List(json)), None, None, None, None, None, None)

48

49 scala> val f = http.run(r, { res: FullResponse =>

ddg.py (https://github.com/ibid/ibid.git) Python · 59 lines

26 params['gl'] = country

27

28 return json_webservice('https://api.duckduckgo.com', params)

29

30 @match(r'^ddg(?:\.com?)?(?:\.([a-z]{2}))?\s+(?:for\s+)?(.+?)$')

duckduck.go (git://github.com/ajanicij/goduckgo.git) Go · 183 lines

15 )

16

17 var baseUrl = "https://api.duckduckgo.com/?q=%s&format=json&pretty=1%s"

18

19 // Message is a structure containing all the information returned by

README.markdown (https://github.com/VarioLabs/ddg-api.js.git) Markdown · 86 lines

47 * Base URL for API, includes the question mark

48 */

49 , baseUrl: "http://api.duckduckgo.com/?"

50

51 /*

52 * SSL Base URL for API, includes the question mark

53 */

54 , sslBaseUrl: "https://api.duckduckgo.com/?"

55

56 /*

searchengine_query.rb (https://bitbucket.org/King_DuckZ/assobiotech.git) Ruby · 82 lines

56 private

57 def getDuckDuckGoApiQuery()

58 return "https://api.duckduckgo.com/?q=#{getCleanText(@searchTerm)}&format=json&pretty=0"

59 end

60

duckduckgo_definitions.py (https://gitlab.com/lanodan/searx.git) Python · 149 lines

5 from searx.engines.xpath import extract_text

6

7 url = 'https://api.duckduckgo.com/'\

8 + '?{query}&format=json&pretty=0&no_redirect=1&d=1'

9

MainViewController.swift (https://github.com/kiavashfaisali/KFSwiftImageLoader.git) Swift · 119 lines

28 // MARK: - Miscellaneous Methods

29 func loadDuckDuckGoResults() {

30 let url = URL(string: "https://api.duckduckgo.com/?q=simpsons+characters&format=json")!

31 let request = URLRequest(url: url, cachePolicy: .returnCacheDataElseLoad, timeoutInterval: 60.0)

32

services.py (https://github.com/keiffster/program-y.git) Python · 78 lines

71 data['DuckDuckGo'] = {}

72 data['DuckDuckGo']['classname'] = 'programy.services.duckduckgo.DuckDuckGoService'

73 data['DuckDuckGo']['url'] = 'http://api.duckduckgo.com'

74

75 else:

knowledgeapi.service.ts (https://github.com/fossasia/susper.com.git) TypeScript · 80 lines

15 homepage = 'http://' + url.susper.site;

16 logo = '../images/susper.svg';

17 imgUrl = 'https://api.duckduckgo.com/?';

18 constructor(private http: Http,

19 private jsonp: Jsonp,

duckduck_test.go (git://github.com/ajanicij/goduckgo.git) Go · 66 lines

12 func TestQuery(t *testing.T) {

13 query := "New York City"

14 expectedUrl := "https://api.duckduckgo.com/?q=New+York+City&format=json&pretty=1"

15 expectedBody := `{

16 "Heading" : "New York City"

50 func TestEncodeUrl(t *testing.T) {

51 query := "!gi New York City"

52 expectedUrl := "https://api.duckduckgo.com/?q=%21gi+New+York+City&format=json&pretty=1&no_redirect=1"

53

54 url := EncodeUrl(query)

58

59 query = "New York City"

60 expectedUrl = "https://api.duckduckgo.com/?q=New+York+City&format=json&pretty=1"

61 url = EncodeUrl(query)

62 if url != expectedUrl {

01-concepts.md (https://github.com/eed3si9n/gigahorse.git) Markdown · 125 lines

63

64 ```console

65 scala> val r = Gigahorse.url("https://api.duckduckgo.com").get.

66 addQueryString(

67 "q" -> "1 + 1",

97 scala> import scala.concurrent._, duration._

98 scala> val http = Gigahorse.http(Gigahorse.config)

99 scala> val r = Gigahorse.url("https://api.duckduckgo.com").get.

100 addQueryString(

101 "q" -> "1 + 1"

duckduckgo.js (https://github.com/Gravebot/Gravebot.git) JavaScript · 92 lines

11 const options = {

12 method: 'GET',

13 url: 'http://api.duckduckgo.com/',

14 json: true,

15 qs: {

duckduckgo_definitions.py (https://github.com/entropage/mijisou.git) Python · 158 lines

7 from searx.utils import html_to_text, match_language

8

9 url = 'https://api.duckduckgo.com/'\

10 + '?{query}&format=json&pretty=0&no_redirect=1&d=1'

11

03-processing.md (https://github.com/eed3si9n/gigahorse.git) Markdown · 91 lines

34 val http = Gigahorse.http(Gigahorse.config)

35

36 val r = Gigahorse.url("https://api.duckduckgo.com").get.

37 addQueryString(

38 "q" -> "1 + 1"

00.md (https://github.com/eed3si9n/gigahorse.git) Markdown · 88 lines

75 scala> import scala.concurrent._, duration._

76 scala> val http = Gigahorse.http(Gigahorse.config)

77 scala> val r = Gigahorse.url("https://api.duckduckgo.com").get.

78 addQueryString(

79 "q" -> "1 + 1"

duckduck.go (git://github.com/ajanicij/goduckgo.git) Go · 112 lines

93 func Query(query string) (*Message, error) {

94 query_enc := url.QueryEscape(query)

95 ddgurl := fmt.Sprintf("http://api.duckduckgo.com?q=%s&format=json&pretty=1", query_enc)

96 resp, err := http.Get(ddgurl)

97 if err != nil {

DuckDuckGoProvider.tsx (https://github.com/matrix-org/matrix-react-sdk.git) TypeScript · 109 lines

33

34 static getQueryUri(query: string) {

35 return `https://api.duckduckgo.com/?q=${encodeURIComponent(query)}`

36 + `&format=json&no_redirect=1&no_html=1&t=${encodeURIComponent(REFERRER)}`;

37 }

test_services.py (https://github.com/keiffster/program-y.git) Python · 103 lines

101

102 test.assertEquals(data['DuckDuckGo']['classname'], 'programy.services.duckduckgo.DuckDuckGoService')

103 test.assertEquals(data['DuckDuckGo']['url'], 'http://api.duckduckgo.com')

104

README.md (https://github.com/shivylp/radium.git) Markdown · 76 lines

56 ## 4. DuckDuckGo

57

58 `duckduckgo.DuckDuckGo` implements `radium.Source` using [DuckDuckGo Instant Answers API](https://api.duckduckgo.com).

59

60 ### Examples:

duckduckgo.py (https://github.com/keiffster/program-y.git) Python · 86 lines

31 # Provide a summary of a single article

32 def ask_question(self, url, question, num_responses=1):

33 # http://api.duckduckgo.com/?q=DuckDuckGo&format=json

34

35 payload = {'q': question, 'format': 'json'}

searching.js (https://github.com/mozilla/firefox-voice.git) JavaScript · 88 lines

31 export async function ddgEntitySearch(query) {

32 const response = await fetch(

33 `https://api.duckduckgo.com/?q=${encodeURIComponent(

34 query

35 )}&format=json&pretty=1&skip_disambig=1`

73 const bang = ddgBangServiceName(service);

74 const response = await fetch(

75 `https://api.duckduckgo.com/?q=!${encodeURIComponent(

76 bang

77 )}+${encodeURIComponent(query)}&format=json&pretty=1&no_redirect=1`

duckduckgo.go (https://github.com/shivylp/radium.git) Go · 73 lines

10 )

11

12 const ddgURL = "https://api.duckduckgo.com"

13

14 // New initializes a duckduckgo based radium source implementation.

02-request.md (https://github.com/eed3si9n/gigahorse.git) Markdown · 121 lines

10 ```console:new

11 scala> import gigahorse._, support.okhttp.Gigahorse

12 scala> val url = "https://api.duckduckgo.com"

13 scala> val r = Gigahorse.url(url)

14 ```

02-request.md (https://github.com/eed3si9n/gigahorse.git) Markdown · 122 lines

10 ```console:new

11 scala> import gigahorse._, support.asynchttpclient.Gigahorse

12 scala> val url = "https://api.duckduckgo.com"

13 scala> val r = Gigahorse.url(url)

14 ```

duckduck-answer.R (https://github.com/dirkschumacher/duckduckr.git) R · 115 lines

2 #'

3 #' Makes a synchronous API call to the DuckDuckGo Instant Answer API.

4 #' Take a look at DuckDuckGo's terms of use (\url{https://api.duckduckgo.com/api}) before using it.

5 #'

6 #' @param query the query string

10 #' @param app_name the appname used to identify your application.

11 #'

12 #' @seealso \url{https://api.duckduckgo.com/api} for more information on the API and their terms of use.

13 #'

14 #' @return Always returns a list. If the API call was successful it contains the response of

52

53 # construct the api call

54 client <- crul::HttpClient$new(url = "https://api.duckduckgo.com/")

55 query_params <- list(

56 q = query,

StoriesList.js (https://github.com/kiok46/duckduckgo.git) JavaScript · 63 lines

15

16 componentWillMount(){

17 //axios.get("http://api.duckduckgo.com/?q=googl&format=json")

18 // .then(response => this.setState({ stories: response.data}));

19 }

ddg.js (https://github.com/BitQuote/AwesomeBot.git) JavaScript · 20 lines

3 module.exports = (bot, db, config, winston, userDocument, serverDocument, channelDocument, memberDocument, msg, suffix, commandData) => {

4 if(suffix) {

5 unirest.get(`http://api.duckduckgo.com/?format=json&q=${encodeURIComponent(suffix)}`).header("Accept", "application/json").end(res => {

6 if(res.status==200) {

7 const data = JSON.parse(res.body);

timezone.js (https://github.com/RayzrDev/SharpBot.git) JavaScript · 54 lines

7

8 let input = args.join(' ');

9 let url = `https://api.duckduckgo.com/?q=${encodeURIComponent(input)}&format=json`;

10

11 await msg.edit(':arrows_counterclockwise: Loading conversion...');

README.md (https://github.com/dirkschumacher/duckduckr.git) Markdown · 51 lines

34 # the original http call

35 attr(res, "source")

36 #> [1] "https://api.duckduckgo.com/?q=ggplot&no_redirect=0&no_html=0&format=json&skip_disambig=0&t=duckduckr"

37 ```

38

server.js (https://github.com/jajoosam/wikibot.git) JavaScript · 58 lines

18 const twiml = new MessagingResponse();

19 if(req.body.Body.toLowerCase().trim()!="hi" && req.body.Body.toLowerCase().trim()!="hello" && req.body.Body.toLowerCase().trim()!="test" && req.body.Body.toLowerCase().trim()!="help"){

20 request('https://api.duckduckgo.com/?skip_disambig=1&format=json&pretty=1&q='+req.body.Body, function (error, response, body) {

21 body = JSON.parse(body)

22 console.log('body:', body["Abstract"]);

url_scrapping.sh (https://github.com/adon90/pentest_compilation.git) Shell · 27 lines

20 duckduckgo() {

21

22 token=$(curl -A "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:67.0) Gecko/20100101 Firefox/67.0" "https://api.duckduckgo.com/?q=site%3A$1" -s | grep -Po "(?<=vqd=).*?(?=&)" | tail -1); curl -A "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:67.0) Gecko/20100101 Firefox/67.0" "https://duckduckgo.com/d.js?q=site%3A$1&vqd=$token" -s | grep -Po "(?<=u\":\").*?(?=\")"

23

24 }

2015-06-26-learn-to-use-apis.html (https://gitlab.com/stephenjbarr/stephen-planetbarr-com) HTML · 93 lines

35 <span style="color: #8b2252;">"pretty"</span> : 1}

36

37 r = requests.get(<span style="color: #8b2252;">'http://api.duckduckgo.com/'</span>, params = payload)

38 r.url

39 rj = r.json()

0.1.0.markdown (https://github.com/eed3si9n/gigahorse.git) Markdown · 25 lines

11

12 scala> Gigahorse.withHttp(Gigahorse.config) { http =>

13 val r = Gigahorse.url("http://api.duckduckgo.com").get.

14 addQueryString(

15 "q" -> "1 + 1",

API.php (git://github.com/duckduckgo/php5-duckduckgo.git) PHP · 163 lines

24

25 /**

26 * The API base URL. This defaults to api.duckduckgo.com.

27 */

28 public $baseURL;

57 $this->noHTML = FALSE;

58 $this->noDisambiguations = FALSE;

59 $this->baseURL = 'api.duckduckgo.com';

60 }

61

README.md (git://github.com/ajanicij/goduckgo.git) Markdown · 104 lines

13 example, the URL for querying about New York City is

14

15 [http://api.duckduckgo.com/?q=New+York+City&format=json&pretty=1](http://api.duckduckgo.com/?q=New+York+City&format=json&pretty=1)

16

17 The previous query causes DuckDuckGo to return the result in JSON format.

example_duckduckgo.html (https://github.com/pawelczak/EasyAutocomplete.git) HTML · 37 lines

17 var options = {

18 url: function (phrase) {

19 return phrase !== '' ? 'http://api.duckduckgo.com/?q=' + phrase + '&format=json' : 'http://api.duckduckgo.com/?q=empty&format=json';

20 },

21

duckduckgo.js (https://bitbucket.org/slimdll/botphp.git) JavaScript · 58 lines

21 const execute = (bot, msg, match) => {

22 const query = match.query

23 const _base = 'http://api.duckduckgo.com/?format=json&q='

24 const _url = url.parse(_base + encodeURIComponent(query))

25 _url.headers = {

Box.vue (https://github.com/paweljw/bookstore-frontend.git) Vue · 49 lines

20 methods: {

21 async pullImage () {

22 const response = await fetch(`http://api.duckduckgo.com/?q=${encodeURIComponent(this.book.title)}&format=json&pretty=1`)

23 const json = await response.json()

24 if (json.Image) {

Duckduckgo.hs (https://github.com/balsoft/lambda-launcher.git) Haskell · 56 lines

35 runReq defaultHttpConfig $ do

36 bs <-

37 req GET (https "api.duckduckgo.com") NoReqBody bsResponse $

38 ("q" =: s) <>

39 ("format" =: ("json" :: String))

test_service.py (https://github.com/AndyLPK247/behavior-driven-python.git) Python · 41 lines

12 # Constants

13

14 DUCKDUCKGO_API = 'https://api.duckduckgo.com/'

15

16

Full.vue (https://github.com/paweljw/bookstore-frontend.git) Vue · 75 lines

29 async pullImage () {

30 this.image = `http://via.placeholder.com/220x320?text=${encodeURIComponent(this.book.title)}`

31 const response = await fetch(`http://api.duckduckgo.com/?q=${encodeURIComponent(this.book.title)}&format=json&pretty=1`)

32 const json = await response.json()

33 if (json.Image) {

duckduckgo.py (https://github.com/jesopo/bitbot.git) Python · 26 lines

3 from src import ModuleManager, utils

4

5 URL_DDG = "https://api.duckduckgo.com"

6

7 class Module(ModuleManager.BaseModule):

Box.vue (https://github.com/paweljw/bookstore-frontend.git) Vue · 44 lines

22 methods: {

23 async pullImage () {

24 const response = await fetch(`http://api.duckduckgo.com/?q=${encodeURIComponent(this.author.name)}&format=json&pretty=1`)

25 const json = await response.json()

26 if (json.Image) {

animal.js (https://gitlab.com/HonestidaMordaz/pet-store.git) JavaScript · 138 lines

33 Animal.prototype.fetchBreedInfo = function(callback) {

34 return reqwest({

35 url: "https://api.duckduckgo.com/",

36 data: {

37 q: this.breed,

api_hooks.py (https://github.com/th3r00t/pyShelf.git) Python · 35 lines

11

12 def __init__(self):

13 self.url = "https://api.duckduckgo.com/?q="

14

15 def image_result(self, query):

2015-06-26-learn-to-use-apis.org (https://gitlab.com/stephenjbarr/stephen-planetbarr-com) Org · 69 lines

33 "pretty" : 1}

34

35 r = requests.get('http://api.duckduckgo.com/', params = payload)

36 r.url

37 rj = r.json()

duckduckgo.js (https://github.com/gildean/dunn.git) JavaScript · 87 lines

64 var qPath = '/?q=' + msg + '&format=json&no_redirect=1&no_html=1';

65 var options = {

66 hostname: 'api.duckduckgo.com',

67 path: qPath

68 };

test_duckduckgo.py (https://github.com/cotobadesign/cotoba-agent-oss.git) Python · 46 lines

37 def test_ask_question_summary(self):

38 config = BrainServiceConfiguration("pannous")

39 config._url = "http://api.duckduckgo.com"

40

41 service = DuckDuckGoService(config=config)

services.py (https://github.com/cotobadesign/cotoba-agent-oss.git) Python · 94 lines

89 data['DuckDuckGo'] = {}

90 data['DuckDuckGo']['classname'] = 'programy.services.duckduckgo.DuckDuckGoService'

91 data['DuckDuckGo']['url'] = 'http://api.duckduckgo.com'

92 else:

93 for service in self._services:

search.py (https://github.com/chassing/irc3.git) Python · 51 lines

40 """

41 q = ' '.join(args['<query>'])

42 resp = self.session.get('http://api.duckduckgo.com/',

43 params=dict(q=q, format='json', t='irc3'),

44 allow_redirects=False)

service.py (https://github.com/AndyLPK247/behavior-driven-python.git) Python · 36 lines

12 # "Constants"

13

14 DUCKDUCKGO_API = 'https://api.duckduckgo.com/'

15

16

DuckDuckGo.pm (https://github.com/duckduckgo/p5-www-duckduckgo.git) Perl · 194 lines

16 is => 'ro',

17 lazy => 1,

18 default => sub { 'http://api.duckduckgo.com/' },

19 );

20

22 is => 'ro',

23 lazy => 1,

24 default => sub { 'https://api.duckduckgo.com/' },

25 );

26

165 =attr params

166

167 A HashRef of extra GET params to pass with the query (documented on https://api.duckduckgo.com/)

168

169 =head1 METHODS

duck.rb (https://github.com/tykeal/TykeBot.git) Ruby · 27 lines

1 config :url,:default=>"http://api.duckduckgo.com/?q=!ducky+%s&format=json&no_redirect=1",:description=>'URL of the duckduckgo.com search api'

2

3 command do

example_duckduckgo.html (https://bitbucket.org/quickfinder/quickfinder-old.git) HTML · 37 lines

17 var options = {

18 url: function(phrase) {

19 return phrase !== "" ? "http://api.duckduckgo.com/?q=" + phrase + "&format=json" : "http://api.duckduckgo.com/?q=empty&format=json";

20 },

21

duckduckgo.py (https://bitbucket.org/pbui/bobbit) Python · 59 lines

9 MODULE_TYPE = 'command'

10

11 DUCKDUCKGO_URL = u'http://api.duckduckgo.com'

12 DUCKDUCKGO_RE = r'^!(ddg|duckduckgo)\s+'

13

abstract.coffee (https://github.com/NNA/hubot-scripts.git) CoffeeScript · 56 lines

26 module.exports = (robot) ->

27 robot.respond /(abs|abstract) (.+)/i, (res) ->

28 abstract_url = "http://api.duckduckgo.com/?format=json&q=#{encodeURIComponent(res.match[2])}"

29 res.http(abstract_url)

30 .header('User-Agent', 'Hubot Abstract Script')

duckduck.js (https://github.com/gcr/ips-lurker.git) JavaScript · 83 lines

13 // run cb(wittyResponse) when DDG returns something special

14 http

15 .createClient(80, 'api.duckduckgo.com')

16 .request('GET', '/?'+querystring.stringify(

17 {q: query, format: "json", no_redirect: 1, no_html: 1}

18 ),

19 {'host':'api.duckduckgo.com'})

20 .on('response', function(res) {

21 // response could come in more than one packet, so create a buffer

test_search.py (https://github.com/apertium/phenny.git) Python · 45 lines

13 def setUp(self):

14 self.engines = {

15 'DuckDuckGo': 'https://api.duckduckgo.com',

16 'Suggestion API': 'http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=test'

17 }

Rakefile (https://github.com/andrewrjones/ruby-duck-duck-go.git) Rakefile · 93 lines

81

82 http = HTTPClient.new

83 json = http.get_content('http://api.duckduckgo.com/', args)

84 ruby = JSON.parse(json)

85

duckduckgo.py (https://github.com/ackwell/ninjabot.git) Python · 69 lines

18 return

19

20 url = 'http://api.duckduckgo.com/'

21 params = {

22 'q': ' '.join(msg.args),

search.py (https://github.com/apertium/phenny.git) Python · 97 lines

15 from web import catch_timeout, is_up, REQUEST_TIMEOUT

16

17 ddg_uri = 'https://api.duckduckgo.com/?format=json&pretty=1&q='

18 suggest_uri = 'http://suggestqueries.google.com/complete/search?client=firefox&hl=en&q='

19

23

24 def topics(phenny, input):

25 if not is_up('https://api.duckduckgo.com'):

26 return phenny.say('Sorry, DuckDuckGo API is down.')

27

51 query = input.group(1)

52

53 if not is_up('https://api.duckduckgo.com'):

54 return phenny.say('Sorry, DuckDuckGo API is down.')

55

opis.html (https://bitbucket.org/nejcv1998/nejcv1998.bitbucket.org.git) HTML · 98 lines

64 <ul>

65 <li>EHRScape API: uporabljen za dostopanje in shranjevanje podatkov bolnika. Uporabljen je naslov: <a href= https://rest.ehrscape.com/rest/v1>https://rest.ehrscape.com/rest/v1</a></li>

66 <li>DuckDuckGo API: uporabljen za iskanje posledic in predlaganje rešitev. Uporabljen je naslov <a href= https://api.duckduckgo.com/?q=DuckDuckGo&format=json>https://api.duckduckgo.com/?q=DuckDuckGo&format=json</a></li>

67 </ul>

68 </p>

ducky_search.rb (https://github.com/alexshook/ducky_search.git) Ruby · 40 lines

31

32 def get_topic_summary(query_string)

33 results = HTTParty.get("http://api.duckduckgo.com/?q=#{query_string}&format=json")

34 abstract = JSON.parse(results)['AbstractText']

35 return abstract.size > 3 ? abstract : "Sorry, a summary is not available for this topic."

duckduckgo.py (git://github.com/Reisen/bruh.git) Python · 76 lines

48 # attribution, so don't remove this.

49 request = Request(

50 'https://api.duckduckgo.com/?{}'.format(urlencode({

51 'q': msg,

52 'format': 'json',

PipeFilter.pm (https://github.com/rcaputo/app-pipefilter.git) Perl · 97 lines

35 JSON::Path's variant of JSONPath.

36

37 curl -s 'http://api.duckduckgo.com/?q=poe&o=json' |

38 jsonpath -o '$..Topics.*.FirstURL' -o '$..Topics.*.Text' |

39 grep -i perl |

calc.py (https://github.com/adiq/stah.git) Python · 72 lines

5 from util import web

6

7 uri = 'http://api.duckduckgo.com/?q=%s&format=json'

8

9

duck_duck_go.rb (https://github.com/andrewrjones/ruby-duck-duck-go.git) Ruby · 58 lines

17 class Main

18

19 API_URL = 'http://api.duckduckgo.com/'

20 API_URL_SECURE = 'https://api.duckduckgo.com/'

Dictionary.java (https://github.com/cnr/Willie.git) Java · 86 lines

13

14 URBAN_DICTIONARY("http://api.urbandictionary.com/v0/define?term=%WORD%", 0, "Urban Dictionary"),

15 DUCK_DUCK_GO("http://api.duckduckgo.com/?q=%WORD%&format=json", 1, "Duck Duck Go");

16 private String url, name;

17 private int id;

getDDG.java (https://github.com/atinsood/Iris-Voice-Automation.git) Java · 138 lines

98 // Safely encode the query as a URL

99 xQuery = URLEncoder.encode(Query,"UTF-8");

100 ddgURL = "http://api.duckduckgo.com/?q="+xQuery+"&format=json";

101

102 // Use Blocking IO with httpGET class

duckduckgo.pl (https://github.com/prsquee/irssi-scripts.git) Perl · 38 lines

15 sub cuac_cuac {

16 my ($server, $chan, $searchme) = @_;

17 my $query = 'https://api.duckduckgo.com/?q='

18 . uri_encode($searchme)

19 . '&format=json';

duck.py (https://github.com/crazedpsyc/crazedpsyc.git) Python · 52 lines

45

46 class conf: # a quick class to simulate the configuration module for running without DOSprompt

47 search_engine = {'name': 'DuckDuckGo', 'url': 'https://api.duckduckgo.com/?q=%s&o=json'}

48

49 if __name__ == '__main__':

services.js (https://github.com/bartolini/angularjs.git) JavaScript · 24 lines

10 // we define a REST resource:

11 return $resource(

12 'http://api.duckduckgo.com/?format=json&q=:q', // this is a URL; please note the "q" parameter!

13 { callback: 'JSON_CALLBACK' }, // this is configuration only

14 { ask: { method: 'JSONP' } } // we define only one method here named "ask"

ddg.coffee (https://gitlab.com/raulhc/telegram-bot) CoffeeScript · 66 lines

4

5 # Busca no DuckDuckGo

6 # http://api.duckduckgo.com/?q=<query>&format=json&pretty=1

7 module.exports = ddg = (query, langs, callback=(->))->

8 logger "DDG Search for \"#{query}\", Open API..."

9 encQuery = encodeURIComponent query

10 url = 'http://api.duckduckgo.com/?format=json&q=' + encQuery

11 request(url, 'Accept-Language': ddg.mkAcceptLang langs)

12 .then (res)->

ddg.py (https://bitbucket.org/dwfreed/guppy.git) Python · 55 lines

41 try:

42 request = "+".join(args)

43 sock = urllib.request.urlopen("http://api.duckduckgo.com/?q=%s&o=json" % request)

44 data = sock.read()

45 sock.close()

Search.cs (https://github.com/cmpct/c-irc-bot.git) C# · 49 lines

44 static string GetDDGApiUrl(string query)

45 {

46 return String.Format("https://api.duckduckgo.com/?q={0}&format=xml&t=IrcBot.Search&no_redirect=1&no_html=1&skip_disambig=1", Uri.EscapeUriString(query));

47 }

48 }

services.js (https://gitlab.com/profound-software/infinity-bookmarks) JavaScript · 12 lines

5 return $resource(relay.url, relay.data({"end":"authentication.php"}), {})

6 })

7 .factory('DuckDuckGo', function($resource) { //http://api.duckduckgo.com/?q=DuckDuckGo&format=json&pretty=1

8 return $resource(relay.url,{"api":"duckduckgo","format":"json"});

9 })

duckduckgosearch.py (https://github.com/laramies/theHarvester.git) Python · 85 lines

14 self.links = []

15 self.database = 'https://duckduckgo.com/?q='

16 self.api = 'https://api.duckduckgo.com/?q=x&format=json&pretty=1' # Currently using API.

17 self.quantity = '100'

18 self.limit = limit

define.py (https://github.com/xray7224/MegBot.git) Python · 45 lines

29 query_string = "+".join(Info.args)

30

31 url = "http://api.duckduckgo.com/?q=%s&format=json" % query_string

32 request = urlopen(url)

33

duck.rb (https://github.com/Ronovan/ruby-rails-jumpstart.git) Ruby · 33 lines

3

4

5 BASE_URL = "http://api.duckduckgo.com/?format=json&pretty=1&q=" # remote API url

6 query = "web services" # query string

7 query_url = BASE_URL + URI.escape(query) # putting the 2 together

DuckDuckGo.pm (https://github.com/trapd00r/WWW-Search-DuckDuckGo.git) Perl · 117 lines

12 use LWP::UserAgent;

13

14 my $base_url = 'http://api.duckduckgo.com/?q='; # $query&o=json

15

16 sub ddg {

index.js (https://github.com/patrickjquinn/P-Brain.ai.git) JavaScript · 28 lines

2

3 async function ddg_resp(query) {

4 const ddg_url = 'http://api.duckduckgo.com/?q=<query>&format=json&pretty=1';

5

6 let data = await request(ddg_url.replace('<query>', query));

duckduckgo.js (https://github.com/gf3/protobot.git) JavaScript · 37 lines

8

9 DuckDuckGo.prototype.search = function( query, cloudback ) {

10 exec("curl 'http://api.duckduckgo.com/?format=json&q=" + escape( query ) + "'", function ( err, stdout, stderr ) {

11 var results = JSON.parse( stdout ) // What could possibly go wrong?

12 cloudback.call( this, results )

WebSearchClient.kt (https://github.com/fossasia/susi_android.git) Kotlin · 18 lines

9 object WebSearchClient {

10

11 private const val BASE_URL = "https://api.duckduckgo.com"

12 val retrofit: Retrofit by lazy {

13 Retrofit.Builder()

App.cs (https://github.com/TheEightBot/Reactive-Examples.git) C# · 36 lines

19 .CurrentMutable

20 .RegisterLazySingleton(

21 () => RestService.For<Services.Api.IDuckDuckGoApi>("https://api.duckduckgo.com"),

22 typeof(Services.Api.IDuckDuckGoApi));

23 }

duckduckr-package.R (https://github.com/dirkschumacher/duckduckr.git) R · 8 lines

1 #' Simple Client for the DuckDuckGo Instant Answer API

2 #'

3 #' Programmatic access to the DuckDuckGo's Instant Answer API <https://api.duckduckgo.com/api>

4 #'

5 #' @name duckduckr

duckduckgo.rb (https://github.com/Terminus-Project/Terminus-Bot.git) Ruby · 136 lines

126 }

127

128 uri = URI('https://api.duckduckgo.com/')

129

130 json_get uri, opts do |json|

DuckDuckGoSearch.java (https://github.com/amnotbot/amnotbot.git) Java · 73 lines

44

45 private final String SEARCH_URL =

46 "http://api.duckduckgo.com/?format=json&t=amnotbot&q=";

47

48 public DuckDuckGoSearch()

listing1.py (https://github.com/abulka/pynsource.git) Python · 18 lines

4 def find_definition(word):

5 q = 'define ' + word

6 url = 'http://api.duckduckgo.com/?'

7 url += urlencode({'q': q, 'format': 'json'})

8 print(url)

ApiConstants.java (https://github.com/minsoopark/android-best-practices-kor.git) Java · 12 lines

4

5 // Just examples. Replace however you need!

6 public static final String BASE_URL = "http://api.duckduckgo.com";

7 public static final int HTTP_CONNECT_TIMEOUT = 6000; // milliseconds

8 public static final int HTTP_READ_TIMEOUT = 10000; // milliseconds

DuckDuckGoSearch.java (https://github.com/jmitchener/amnotbot.git) Java · 82 lines

48

49 private final String SEARCH_URL =

50 "http://api.duckduckgo.com/?format=json&q=";

51

52 public DuckDuckGoSearch()

DuckDuckGoSearchController.cs (https://github.com/bitcake/bitstrap.git) C# · 11 lines

1 namespace BitStrap.Examples

2 {

3 //http://api.duckduckgo.com/?q=goku&format=json

4 [WebUrl( "" )]

5 public class DuckDuckGoSearchController : WebController<DuckDuckGoSearchController>

seeds.js (https://gitlab.com/ctaloi/rest2ddp) JavaScript · 14 lines

2 {

3 collectionName: "duckDuckGoSearchMeteor",

4 restUrl: "http://api.duckduckgo.com/?q=meteor&format=json&pretty=1",

5 jsonPath: "$.RelatedTopics.*",

6 pollInterval: 5

search.py (https://github.com/dcbriccetti/python-lessons.git) Python · 5 lines

2

3 search_arg = 'Guido von Rossum'

4 response = requests.get('https://api.duckduckgo.com/?q=%s&format=json&pretty=1' % search_arg).json()

5 print('From {}: {}'.format(response['AbstractSource'], response['Abstract']))

6

addNotableGroceryStores.rb (https://github.com/rantav/recipitor-frontend.git) Ruby · 7 lines

3 # >> Paste this long line

4 # condensed in one line for heroku's console; yuk

5 g = JSON.parse(IO.read('NotableGroceryStores.json')); g['map'].each { |k,v|; puts k; r = Net::HTTP.get 'api.duckduckgo.com', "/?q=#{URI.escape(k)}&o=json"; j = JSON.parse(r); url = nil; url = j['Results'][0]['FirstURL'] if j and j['Results'] and j['Results'][0]; StoreChain.create(:name => k, :url => url) and puts url}

6

7

duckduckgo.py (https://bitbucket.org/agiliq/searchapi) Python · 17 lines

6 class Duck(object):

7 def __init__(self):

8 self.end_point='http://api.duckduckgo.com/?q='

9

10 def duckduckgo(self,query):

DuckDuckGo.php (https://github.com/bobdia/COLibrary.git) PHP · 35 lines

10 public $disambig; // disambiguation

11

12 public $url = 'http://api.duckduckgo.com/';

13

14 public function __construct($query, $disambiguation=null) {

duckduckgo.com.rb (https://bitbucket.org/andey/bestofama.git) Ruby · 12 lines

3 class DuckDuckGo

4 include HTTParty

5 base_uri 'api.duckduckgo.com'

6

7 def search(text)

duckduckgo-parse.go (https://github.com/sbhackerspace/sbhx-snippets.git) Go · 27 lines

11

12 const (

13 DDG_API_BASE_URL = "api.duckduckgo.com"

14 DDG_API_URL = "http://api.duckduckgo.com/?q=%s&format=json"

15 DDG_API_URL_SECURE = "https://api.duckduckgo.com/?q=%s&format=json"

16 DEBUG = true

17 )