TrianguloY / URLCheck

Android app by TrianguloY: URLCheck
Other
969 stars 57 forks source link

allow searching with search engine #377

Open KorigamiK opened 2 months ago

KorigamiK commented 2 months ago

Describe a related problem (optional)

When sharing a search query that's not a url the app doesn't allow any actions. Screenshot_2024-09-04-02-59-55-12_21561dfd7cdb810023cdb17e8b11e256

Describe your suggested feature

An ability to use the input as a search query to open in the browser which searches on Google et al. as a popover (not persisting this tab) would be great.

Describe alternatives you've considered for your suggested feature

No response

Other details

No response

Acknowledgements

TrianguloY commented 2 months ago

Several things here:

When sharing a search query that's not a url the app doesn't allow any actions.

The open button is disabled since there is no app that can open that url (because it's not a url). However the share option is still available. Some apps like Firefox allow you to 'send' them text and they will automatically perform a search (but I know is not as 'simple' as opening a url)

An ability to use the input as a search query to open in the browser which searches on Google et al.

Another alternative is to use a pattern to convert any text to a url of the search itself. This one for example for google:

  "Search on google": {
    "encode": true,
    "regex": ".*",
    "replacement": "https:\/\/www.google.com\/search?q=$0"
  }

as a popover (not persisting this tab) would be great.

That is achieved by using the custom tabs button (the one at the left of the open module, in your screenshot opening as custom tab is already enabled) image

I'll keep this issue open because maybe a separate module to choose to search with different search providers may be useful, in case it is implemented in the future.

KorigamiK commented 2 months ago

Screenshot_2024-09-05-00-24-15-47_6f8f7a6a69f2aa2976412416ecb84f7a.jpg

Great! Do you know if there is a way to add a urlChecker to this popup context menu on any selected text (I'm not sure of the name)

TrianguloY commented 2 months ago

Not currently, there is https://github.com/TrianguloY/UrlChecker/issues/191 to implement it.

Maybe there is an app that you can use to add arbitrary shortcuts to that menu?

You will always have the share->URLCheck option though...

KorigamiK commented 2 months ago

That is achieved by using the custom tabs button (the one at the left of the open module, in your screenshot opening as custom tab is already enabled)

Although sharing to firefox works, this doesn't solve my problem. Firefox still opens a new tab to search this query. The share button doesn't respect the custom tabs button.

I also wasn't able to figure out how the regex replacement works and how I can use in the app.

TrianguloY commented 2 months ago

Although sharing to firefox works, this doesn't solve my problem. Firefox still opens a new tab to search this query. The share button doesn't respect the custom tabs button.

Arg, you are right, the custom tabs are only for opening.

I also wasn't able to figure out how the regex replacement works and how I can use in the app.

You should: 1) open the app > modules > pattern checker > advanced editor 2) scroll to the bottom, then paste the snippet above before the last close bracket "}" and also add a comma before it.

Assuming you have the default patterns, you sould have at the end this:

...
  "Youtube ➔ Invidious": {
    "regex": "^https?:\/\/(?:[a-z0-9-]+\\.)*?youtube.com\/(.*)",
    "replacement": [
      "https:\/\/yewtu.be\/$1",
      "https:\/\/farside.link\/invidious\/$1"
    ],
    "enabled": "false"
  }
}

And after pasting as explained you should have this instead (remember the extra comma!)

...
  "Youtube ➔ Invidious": {
    "regex": "^https?:\/\/(?:[a-z0-9-]+\\.)*?youtube.com\/(.*)",
    "replacement": [
      "https:\/\/yewtu.be\/$1",
      "https:\/\/farside.link\/invidious\/$1"
    ],
    "enabled": "false"
  },
  "Search on google": {
    "encode": true,
    "regex": ".*",
    "replacement": "https:\/\/www.google.com\/search?q=$0"
  }
}

If pasted correctly pressing save will close the dialog. Then make sure the module is enabled, and next time you open the app you will find an "apply - search on google" button.

Using other searches should be easy, but if you are having issues just say which page you want and I'll create it for you.

Btw: you can check other patterns here: https://github.com/TrianguloY/UrlChecker/wiki/Custom-patterns