tmcknight / Movie-and-TV-Show-Search-Alfred-Workflow

An Alfred workflow to search for a movie (or TV show) and get a few ratings
MIT License
95 stars 7 forks source link

Not Opening in Default Browser #4

Closed r3volution11 closed 7 years ago

r3volution11 commented 7 years ago

For some reason when I search using this now it opens Firefox when Chrome is my default browser. I believe I may have had a typo or something that caused the switch but haven't found any information on how to fix it. The problem only occurs with this workflow. Everything else that interacts with a browser is still working correctly.

I even tried throwing Firefox in the trash. It then started opening Safari.

It's very strange. I appreciate any help. Thanks!

tmcknight commented 7 years ago

Hi @r3volution11, a couple questions: Are you attempting to open the first item in the list (which opens a file:// url)? If so, I'd look into the default application used for HTML files. Does the same thing happen if you try to open the IMDb item?

r3volution11 commented 7 years ago

@tmcknight I'm sorry, I should have specified that. I'm talking about the IMDb item. I've resorted to copying the IMDb URL for now until I can figure out what in the world happened.

tmcknight commented 7 years ago

@r3volution11 Bummer! The workflow uses Python's webbrowser module to open the tab in (what should be) the default browser. webbrowser.open_new_tab(url) This is in the Run Script action of the workflow.

If you set your default browser to Safari (as opposed to Chrome), does it open in Safari? I'm wondering if the issue is with the webbrowser python module and Chrome.

Another workaround would be to switch the Run Script action in the workflow to an Open URL action. This would be what most other workflows would use to open a URL. The reason I use the webbrowser python module is for the "Search All" result item (to open multiple browser tabs at once), therefore this workaround would break that functionality.

r3volution11 commented 7 years ago

@tmcknight That's what I was just looking into. Apparently an environment variable can be set to always open a certain browser. May give that a shot.

I just tried setting Safari as my default and it still opened Firefox.

If the environment variable doesn't work out I'll just change it to the run script action. I never use search all. I mostly visit IMDb and like seeing the tomatometer.

Thanks for your help!

tmcknight commented 7 years ago

@r3volution11 No problem! Let me know what you find out.

ghost commented 7 years ago

I have the same problem. When I run

import webbrowser

urls = "http://google.com".split("||")
for url in  urls:
    webbrowser.open_new_tab(url)

from terminal it opens in Chrome, same for open http://google.com. Alfred opens links in Safari though. Tested with IMDB and YouTube trailers.

All works as expected with action changed to Open URL.

Any clues?