Giter VIP home page Giter VIP logo

Comments (8)

wookayin avatar wookayin commented on June 17, 2024 2

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.

wookayin avatar wookayin commented on June 17, 2024 2

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.

dastefster avatar dastefster commented on June 17, 2024

I just ran into this issue as well

from alfred-urban-dictionary.

xilopaint avatar xilopaint commented on June 17, 2024

Unfortunately, it's an API issue. There's nothing I can do about it.

from alfred-urban-dictionary.

xilopaint avatar xilopaint commented on June 17, 2024

@wookayin could you explain how your patch works?

from alfred-urban-dictionary.

wookayin avatar wookayin commented on June 17, 2024

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.

xilopaint avatar xilopaint commented on June 17, 2024

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.

xilopaint avatar xilopaint commented on June 17, 2024

Good to know.

from alfred-urban-dictionary.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.