Expand t.co
URLs and cleanup
#21
Comments
Glad to read someone who has the same opinion as me on Twitter URL and UTMs 😊 I'll try to make a PR for this. I've done similar work for a chrome extension as well https://dev.to/paulleclercq/twitter-without-short-links--1cig |
I would like to add my Mocha tests from my chrome extension to the projects, but I'm not sure how to add them. Could you show me an example please ? https://github.com/sindresorhus/refined-twitter/blob/master/test/index.js |
test.serial('should remove every t.co URLs with their real URLs', t => {
const tweet = document.querySelector('#testExtension');
tweet.setAttribute('href', 'http://t.co/fdmQ6yXo8G');
tCoUrls();
// Now we check that we do not have http://t.co/fdmQ6yXo8G anymore
t.is(tweet.getAttribute('href'), 'http://www.wake-me-up.co');
}); More in the docs: https://github.com/avajs/ava |
function removeUtms(inputUrl) {
var url = new URL(inputUrl)
url.searchParams.forEach(function(value, key) {
if (value.indexOf('utm_') !== -1 || key === 'ref' || key === 'affil' || key === 'zanpid')
url.searchParams.delete(key)
})
return url.toString()
} This snippet is to clean |
@issuehuntfest has funded $60.00 to this issue. See it on IssueHunt |
@polomarcus has submitted a pull request. See it on IssueHunt |
@sindresorhus has rewarded $54.00 to @sindresorhus. See it on IssueHunt
|
Closing as this extension is now deprecated. |
We should expand the useless
t.co
redirects to the full URL. The full URL is available in the.js-display-url
element.We should also clean away query params like:
utm_source
utm_medium
utm_content
utm_campaign
utm_term
utm_id
ref=producthunt
Suggestions for additional ones are welcome!
IssueHunt Summary
sindresorhus has been rewarded.
Backers (Total: $60.00)
Submitted pull Requests
Tips
The text was updated successfully, but these errors were encountered: