5 ms·
For ages I've wanted DuckDuckGo to add a "!copy" bang, which acts like the "!" operator (automatically navigates to the first search result) but instead of goin
by AlphaWeaver 6y ago
For ages I've wanted DuckDuckGo to add a "!copy" bang, which acts like the "!" operator (automatically navigates to the first search result) but instead of going to the page, it copies the link to my clipboard.
There are plenty of projects I'm familiar with but don't know the canonical URL off the top of my head - when I link someone else to them I have to look up their homepage. This would make this process much faster.
- jchook 6y agoI built a simple node JS server to use as my default search engine. What you describe could be a 2-line change to my code. My motivation was using Google "I'm Feeling Lucky" without JS. The node app detects the "!lucky" bang, downloads the search results, finds the first link, and redirects to it. Let me know if it interests you.
- glouwbug 6y agoI'm not perfectly understanding of such legalities, so correct me if I am wrong, but wouldn't this be infringing on scraping territory?
- jchook 6y agoScraping may violate of Google's own acceptable use policy, but it's not illegal.
- dylan604 6y agoSure, it's only okay for Google to scrape all websites, but not you scraping it. Got it.
- samatman 6y agoGoogle is quite scrupulous about robots.txt. There's plenty of hypocrisy at that company but this doesn't strike me as a case of it.
- decasteve 6y agoScrupulous? Nobody is going to disallow / on Google's user-agent. I'd suggest respecting Google's robots.txt as much as Google respects our DNT settings.
- ebfe1 6y agoHi jchook, i would love to play with it and might try to port it to cloudflare worker for personal use :) I was thinking of exact same thing before bed last night when someone at work commented on how much revenue from Ad Google loses from "Im feeling lucky" feature which bypass all Ads
- forgotmypw17 6y agoI too use a custom "search engine", because I want to use a different provider depending on language of query.
- yewenjie 6y agoI just realized I need this for myself and quickly cooked up a solution using tridactyl, ddgr, and jq that fits perfectly in my workflow. Everything is reduced to just typing `:cp <SEARCH QUERY>` without moving to a new tab or losing flow. The entire function is basically this (requires Tridactyl native messenger). command cp js -p tri.native.run('cd ~ && ddgr --json -n 1 ' +JS_ARG + '| jq -r ".[0].url" | xclip -sel clip') [1] https://github.com/tridactyl/tridactyl https://github.com/tridactyl/tridactyl [2] https://github.com/jarun/ddgr https://github.com/jarun/ddgr [3] https://stedolan.github.io/jq/ https://stedolan.github.io/jq/ PS: I used this tool itself to find the links for the three projects mentioned above.
- freeqaz 6y agoIs this dangerous if the link is able to inject Bash commands as the value of JS_ARG? If so, that's RCE and that's bad. Is it possible to do this using the HTML5 clipboard functions instead?
- coopsmgoops 6y agoMaybe, but I'm pretty sure browsers block the clipboard functions unless they were triggered via user input. I don't know if a page load counts as a valid trigger.
- bovine3dom 6y ago`document.execCommand("copy")` works without user input - https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand https://developer.mozilla.org/en-US/docs/Web/API/Document/ex....
- earthboundkid 6y agoNope. > Conditions of having this behavior enabled vary from one browser to another, and have evolved over time. If you're not running based on a click event, you'll certainly fail.
- qwerty456127 6y ago> For ages I've wanted DuckDuckGo to add a "!copy" bang, which acts like the "!" operator (automatically navigates to the first search result) but instead of going to the page, it copies the link to my clipboard. Why? I'm seriously curious about cases in which any of these can be useful.