Comments (8)
This is an API issue and they are lazy to fix this (I have reported the bug to the support).
I patched the urban_dictionary.py
file on my own as follows, and it works well for me:
+ permalink = result['permalink']
+ permalink = re.sub(r'^https?://([^.]+).urbanup.com/', r'http://urbanup.com/', permalink)
wf.add_item(valid=True,
title=title,
subtitle=result['definition'],
- arg=result['permalink']
+ arg=permalink)
Don't forget to add import re
at the top.
from alfred-urban-dictionary.
I heard back from the UrbanDictionary support team and it appears they have fixed the issue. I can confirm that the permalink coming from the API response (i.e. with some subdomains) works very well. So we do not need to apply the patch, and I think this can be now closed.
from alfred-urban-dictionary.
I just ran into this issue as well
from alfred-urban-dictionary.
Unfortunately, it's an API issue. There's nothing I can do about it.
from alfred-urban-dictionary.
@wookayin could you explain how your patch works?
from alfred-urban-dictionary.
It is self-explanatory, isn't it? When you check the output of the API, the permalink field would look like:
permalink: "http://hi.urbanup.com/7933142",
for the query hi
. In general, the subhost equals the query, slugged. That's why you get a "there is no such a host" error. Instead, http://urbanup.com/<ID>
works. So the patch simply tries to get rid of this errornous subdomain.
from alfred-urban-dictionary.
It is self-explanatory, isn't it?
I'm a bit lazy with regular expressions so I just wanted you explain the substitution made by the code snippet. Now it's clear. Thank you!
Btw, have you gotten any feedback from the support? I'm undecided about either implementing the patch or waiting the fix on API side.
from alfred-urban-dictionary.
Good to know.
from alfred-urban-dictionary.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alfred-urban-dictionary.