Jump to content

Wikipedia workflow (alternate)


Recommended Posts

Hi,

 

ist it possible to set one language as the standard, but optionally use other languages by adding the language code?

 

So, when I type "w {query}" it searches the English Wikipedia, but when I type "w de {query}" it searches the German one?

 

 

Thanks

Link to post
  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Quite a simple workflow to search articles on wikipedia (English version). Inspired by a similar workflow here, but it appears the download link is broken...     Based on feedback from folks, I h

Hi all, thanks to all your feedback,  I have created a new version put up here, with slightly better support for multi language search.  See the first post in this topic for details and try it out.

Hi there, Can you try downloading the latest workflow from my original download link?   After that, you need to change en.wiki to zh.wiki in two places in w.py.     in search_for() rt_api =

Hi,

 

ist it possible to set one language as the standard, but optionally use other languages by adding the language code?

 

So, when I type "w {query}" it searches the English Wikipedia, but when I type "w de {query}" it searches the German one?

 

 

Thanks

 

One way to do this is to add a hotkey to the workflow. When the hotkey is triggered it is configured so that the text "en " (note the space at the end)  is passed on to the search portion (the script filter) of the workflow.

 

Now, we you press the hotkey, you get English search by default. But you can always go back to multi language search using "w <code> ".

 

Here is a modified version (stripped of the hotkey - so you need to set it to your liking) that you can try.

Edited by Benzi
Link to post

Thank you Benzi for sharing your Workflow with us.

 

I use your Workflow to search the official RealBasic Wiki and it works like a charm. But i would like to remove all the unnecessary code, because i do not need the multilanguage option.

And i can't get suggestions make show up while entering the query. :-(

 

I hope someone can take a look at the code and help me out here. :-)

 

Thank you

 

Here is my RBWiki Workflow: RealBasic Wiki Search.alfredworkflow

Edited by Guest
Link to post

Thank you Benzi for sharing your Workflow with us.

 

I use your Workflow to search the official RealBasic Wiki and it works like a charm. But i would like to remove all the unnecessary code, because i do not need the multilanguage option.

And i can't get suggestions make show up while entering the query. :-(

 

I hope someone can take a look at the code and help me out here. :-)

 

Thank you

 

Here is my RBWiki Workflow: https://dl.dropbox.com/u/9575378/RealBasic%20Wiki%20Search.alfredworkflow

 

Hi thanks! one small suggestion - try posting your query in the Workflow Help and Questions section of this forum - it would probably gain more traction there rather than here; more people viewing your post will increase your chances of getting help.  

Link to post

there is a bug search by chinese:

54862a3fjw1e3a5gnepu6j.jpg

 

and the wikipedia api response is ok:

http://zh.wikipedia.org/w/api.php?action=query&list=search&srprop=timestamp&format=json&srsearch=朱棣

 

....

i'm not familar with python, don't know how to fix it.

 

 

Hi, can you try re-downloading the workflow again? I made a small change and am hoping that will resolve the problem.

 

Download link. (all download links point to the latest version)

Link to post
  • 2 weeks later...

Would it be possible to show the first string of text after the title of each wikipedia article as the subtext under each search result? So if I searched for Alfred (software) it would say in the subtext "Alfred is an application launcher and productivity application for Mac OS X..." instead of "read about Alfred (software". 

 

 

Great workflow - thanks!

 

Its do-able. The latest version does that.

 

titles.png

Link to post

I type "w zh 中華民國" and expect to find the Chinese language wikipedia page for Taiwan, instead I am given search results for the English version of the page. Am I doing something wrong?

 

If you just downloaded the latest version, I had put in en search on by default. To change that, you need to do the following:

  • Open up Alfred Preferences
  • Locate the Wikipedia ML search workflow and select it
  • Open up the Script Filter box (the one with the Wikipedia logo) by clicking it
  • There will be a text area at the bottom where you need to check the following:
  • The last line should be something like: "python w.py en {query}" - which means that the search will be against the English site. To make it use the Chinese version, you need to change that like to "python w.py {query}" (without en).
  • Now, if you type in Alfred "w zh  中華民國" it should be against the Chinese site.

Please let me know if this helps.

 

EDIT in fact, upon re-reading my original post for the workflow, I realized the cause of the confusion. So I have updated the workflow at the download link to work by default in multilanguage search mode. So you can re-download the workflow and use as is... and no need to mess about with the internals

Edited by Benzi
Link to post

Hi, I just want to report a small bug. I notice that the search term cannot contain an apostrophe. Try searching for any term that includes an apostrophe and it doesn't work.

 

Ah yes... for now, to search with single quotes, use \'.

 

e.g. w en world\'s largest

Link to post

Love this workflow.

 

I hope you don't mind me asking in here but is there a way to modify this to show band discographies by typing (for instance) "w d [band name]". Obviously this isn't necessarily a feature that everyone wants so I don't mind modifying the workflow myself but I'm fairly amateur at coding so a point in the right direction would be great.

 

Really i'm just looking for a workflow to quickly access discographies but I haven't found one yet.

 

Thanks.

Edited by BarelakedNadies
Link to post

Love this workflow.

 

I hope you don't mind me asking in here but is there a way to modify this to show band discographies by typing (for instance) "w d [band name]". Obviously this isn't necessarily a feature that everyone wants so I don't mind modifying the workflow myself but I'm fairly amateur at coding so a point in the right direction would be great.

 

Really i'm just looking for a workflow to quickly access discographies but I haven't found one yet.

 

Thanks.

 

I don't think Wikipedia exposes that sort of information in a way that would make it easy to extract discographies alone. The only closest thing I could find in terms a of development friendly API is http://bandcamp.com/developer, but they have stopped providing API keys.

 

In order to get this information from Wikipedia, I suppose you may need to extract the text of the article, parse it with some Media Wiki parser, and get the relevant sections out - although, having looked at a couple of band pages on Wikipedia, there is no set convention on how discographies are listed, some are in tables, some are in plain lists etc...

 

I may be wrong, but Wikipedia might not be the best / easiest place to get this information programatically.

Link to post
  • 4 weeks later...
  • 2 weeks later...

Hello there, I would like a monolingual (English) version of this. I'm not a programmer so I don't understand what file to edit in order to achieve. Please point me in the write direction. As long as you don't make any assumptions, I can follow.

 

Thanks in advance.

Link to post

Love this workflow.

 

I hope you don't mind me asking in here but is there a way to modify this to show band discographies by typing (for instance) "w d [band name]". Obviously this isn't necessarily a feature that everyone wants so I don't mind modifying the workflow myself but I'm fairly amateur at coding so a point in the right direction would be great.

 

Really i'm just looking for a workflow to quickly access discographies but I haven't found one yet.

 

Thanks.

 

At the risk of derailing this thread, have you looked into something like the Discogs.com API, or even Last.fm's? I haven't used the Discogs API before but it looks pretty good, and I'm familiar enough with Last.fm's to say that would work as well.

 

If this is something you want to ask for help about, I would recommend a new thread at this point, though.

Link to post
  • 4 months later...
  • 1 year later...

This workflow is brilliant--thank you for programming it! I run an English school in Japan and this workflow is going to save me a ton of time cross-linking posts on social media for my students. Thank you so much.

 

I found this because lately I've been searching online for a workflow like this for the new Workflow app for iOS that launched last December. I don't suppose anyone (or Benzi himself?) has made/knows about such a workflow?

Link to post

I found this because lately I've been searching online for a workflow like this for the new Workflow app for iOS that launched last December. I don't suppose anyone (or Benzi himself?) has made/knows about such a workflow?

 

I just looked up that app, and it seems neat. But the approach to creating something like (from the bit that I read) seems incompatible with most of the work that is done with Alfred workflows. The main reason is that the iOS app seems to need the applications themselves to have either coded in actions or the iOS workflows app provides the actions, and these, for the most part, need to be written and compiled with Objective-C (or Swift) and rely mostly on iOS URI schemes and callbacks to make everything work.

 

Workflows for Alfred are coded with scripting languages (AppleScript, Bash, Perl, PHP, Python, Ruby, Zsh, etc...), which are not available in the same way, if at all, on iOS. So while the functionality might be the same, the approach to implementing them is not cross-compatible, thus not portable.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...