Skip to content

Instantly share code, notes, and snippets.

@johnste
Created June 24, 2019 19:43
Show Gist options
  • Save johnste/2883aa088fe46b926bda5afc3eb32953 to your computer and use it in GitHub Desktop.
Save johnste/2883aa088fe46b926bda5afc3eb32953 to your computer and use it in GitHub Desktop.
const regex = /^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(?:es)?\/(\d+)(?:\/.*)?$/
module.exports = {
defaultBrowser: "Google Chrome",
rewrite: [
{
match: ({urlString}) => {
const matches = urlString.match(regex);
finicky.log(JSON.stringify(matches, null, 2))
return matches && matches[2];
},
url: ({ urlString }) => {
const [_, user, statusId] = urlString.match(regex);
return `tweetbot://${user}/status/${statusId}`;
}
}
],
handlers: [
{
match: ({ url }) => url.protocol === "tweetbot",
browser: "com.tapbots.Tweetbot3Mac"
},
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment