Skip to content

Instantly share code, notes, and snippets.

@koedoyoshida
koedoyoshida / search_before_you_tweet.js
Created April 12, 2021 07:52 — forked from paulmwatson/search_before_you_tweet.js
A simple bookmarklet that searches Twitter with the URL you are on.
// A simple bookmarklet that searches Twitter with the URL you are on.
// Before you Tweet your own hot-take see what others are saying and ReTweet them instead.
// Author: @paulmwatson
// License: MIT
// Notes: It first looks for the "canonical" URL before falling back to the window.location.
// It strips any URL parameters e.g. UTM and keeps just the protocol, host, and path.
// This broadens the search as often UTM or other identifiers are unique to your session
// and Twitter's search will return no results. However it can be inacurate on websites
// that use URL parameters to identify content to show.
// Usage: Visit an article on a website like Buzzfeed.com and click the bookmarklet. A new tab
#!/bin/sh
if test $# -lt 2; then
echo "Usage: $0 <common name> <output> [ca options ...]" >&2
exit 1
fi
cn=$1
out=$2
shift 2