We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9cf114c commit 253c805Copy full SHA for 253c805
1 file changed
plugins/amazon.py
@@ -1,5 +1,6 @@
1
import requests
2
from bs4 import BeautifulSoup
3
+from urllib.parse import urlparse
4
5
from cloudbot import hook
6
from cloudbot.util import web, formatting
@@ -43,6 +44,9 @@ def amazon(text):
43
44
except AttributeError:
45
rating = "No Ratings"
46
- url = web.try_shorten(item.find('a', {'class': 's-access-detail-page'})['href'])
47
+ # clean up garbage url
48
+ o = urlparse(item.find('a', {'class': 's-access-detail-page'})['href'])
49
+ url = o.scheme + "://" + o.netloc + o.path + "?linkCode=as2&tag=cloudbot-20"
50
+ url = web.try_shorten(url)
51
52
return "\x02{}\x02 ({}) - {} - {}".format(title, price, rating, url)
0 commit comments