Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
DuckDuckGo Plugin #9
Conversation
paddatrapper
added some commits
May 23, 2016
stefanor
reviewed
Aug 20, 2016
| +/build/ | ||
| +/Ibid.egg-info/ | ||
| +/dist/ | ||
| +/bothome/ |
stefanor
reviewed
Aug 20, 2016
| @@ -8,28 +8,28 @@ | ||
| def monkey_patch(): | ||
| import sqlalchemy.dialects.postgresql | ||
| sqlalchemy.dialects.postgresql.dialect.ischema_names['citext'] = IbidUnicodeText | ||
| - def postgres_visit_IBID_VARCHAR(self, type_): | ||
| + def postgres_visit_IBID_VARCHAR(self, type_, **kw): | ||
| if type_.case_insensitive: | ||
| return 'CITEXT' | ||
| else: | ||
| return self.visit_VARCHAR(type_) |
stefanor
reviewed
Aug 20, 2016
| @@ -0,0 +1,66 @@ | ||
| +# Copyright (c) 2008-2011, Michael Gorven, Stefano Rivera |
stefanor
reviewed
Aug 20, 2016
| +}} | ||
| + | ||
| +default_user_agent = 'Mozilla/5.0' | ||
| +default_referer = "http://ibid.omnia.za.net/" |
stefanor
Aug 20, 2016
Owner
Stick to one quote style for the whole file. Single quotes tend to be preferred.
stefanor
reviewed
Aug 20, 2016
| + params['gl'] = country | ||
| + | ||
| + headers = {'referer': self.referer} | ||
| + return json_webservice('http://api.duckduckgo.com', params, headers) |
stefanor
reviewed
Aug 20, 2016
| + headers = {'referer': self.referer} | ||
| + return json_webservice('http://api.duckduckgo.com', params, headers) | ||
| + | ||
| + @match(r'^(ddg|duckduckgo(?:\.com?))?(?:\.([a-z]{2}))?\s+(?:for\s+)?(.+?)$') |
stefanor
reviewed
Aug 20, 2016
| + topic = "Results" | ||
| + for item in items[topic]: | ||
| + title = item['Text'] | ||
| + results.append(u'"%s" %s' % (decode_htmlentities(title), item['FirstURL'])) |
stefanor
reviewed
Aug 20, 2016
| + topic = "RelatedTopics" | ||
| + for i in range(5): | ||
| + if i >= len(items[topic]): | ||
| + break |
stefanor
reviewed
Aug 20, 2016
| + break | ||
| + try: | ||
| + title = items[topic][i]['Text'] | ||
| + results.append(u'%s' % (decode_htmlentities(title))) |
stefanor
reviewed
Aug 20, 2016
| + title = items[topic][i]['Text'] | ||
| + results.append(u'%s' % (decode_htmlentities(title))) | ||
| + except KeyError: | ||
| + pass |
stefanor
reviewed
Aug 20, 2016
| + if country is not None: | ||
| + params['gl'] = country | ||
| + | ||
| + headers = {'referer': self.referer} |
paddatrapper
added some commits
Dec 2, 2016
|
All issues corrected |
stefanor
merged commit f539c21
into
ibid:master
Jan 31, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
paddatrapper commentedJun 27, 2016
Created a DuckDuckGo Instant Answer query plugin. Also fixed the DB connection to work with newer versions of sqlalchemy.