Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search: cleanup dead stuff #1856

Merged
merged 1 commit into from
May 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions sopel/modules/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@
header_spoof = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
}


def formatnumber(n):
"""Format a number with beautiful commas."""
parts = list(str(n))
for i in range((len(parts) - 3), 0, -3):
parts.insert(i, ',')
return ''.join(parts)


r_bing = re.compile(r'<li(?: class="b_algo")?><h2><a href="([^"]+)"')
r_duck = re.compile(r'nofollow" class="[^"]+" href="(?!(?:https?:\/\/r\.search\.yahoo)|(?:https?:\/\/duckduckgo\.com\/y\.js)(?:\/l\/\?kh=-1&amp;uddg=))(.*?)">')


def bing_search(query, lang='en-US'):
Expand All @@ -46,9 +37,6 @@ def bing_search(query, lang='en-US'):
return m.group(1)


r_duck = re.compile(r'nofollow" class="[^"]+" href="(?!(?:https?:\/\/r\.search\.yahoo)|(?:https?:\/\/duckduckgo\.com\/y\.js)(?:\/l\/\?kh=-1&amp;uddg=))(.*?)">')


def duck_search(query):
query = query.replace('!', '')
base = 'https://duckduckgo.com/html/'
Expand All @@ -64,10 +52,6 @@ def duck_search(query):
return web.decode(m.group(1))


# Alias google_search to duck_search
google_search = duck_search


def duck_api(query):
if '!bang' in query.lower():
return 'https://duckduckgo.com/bang.html'
Expand Down