Skip to content

Instantly share code, notes, and snippets.

@craigmaslowski
Last active August 29, 2015 14:02
Show Gist options
  • Save craigmaslowski/233494258a9ca4503c77 to your computer and use it in GitHub Desktop.
Save craigmaslowski/233494258a9ca4503c77 to your computer and use it in GitHub Desktop.
Upworthy Blogspam Killer

Code for a Chrome extension that will bypass Upworthy's blogspam and go directly to the embedded Youtube video.

var iframes = document.getElementsByTagName('iframe'),
src;
for (var i = 0; i < iframes.length; i++) {
src = iframes[i].src;
if (/\/embed\//.test(src)) {
var videoId = src.substring(src.indexOf('embed/')+6, src.indexOf('?'));
window.location.href = 'http://youtube.com/watch?v=' + videoId;
}
}
{
"name": "Skip Upworthy",
"version": "0.0.1",
"manifest_version": 2,
"description": "Skip Upworthy",
"homepage_url": "http://google.com",
"default_locale": "en",
"content_scripts": [
{
"matches": [
"*://www.upworthy.com/*",
"*://upworthy.com/*"
],
"js": [ "buhbye.js" ]
}
],
"permissions": ["activeTab"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment