Tagged: User JS

A GreaseMonkey script to generate RSS feed links for YouTube channels

Many people use RSS feeds as the primary means to access news and information. RSS is anonymous and does not require you to log in.

Though YouTube generates RSS feeds for its channels, it does not display them (to human visitors) or advertise them (to browser software). If you prefer to subscribe to YouTube videos via RSS, then you have to manually construct the the feed URL for each channel.

I decided to automate the task using this Greasemonkey script. A few seconds after a YouTube video page gets loaded, the Greasemonkey Javascript adds an RSS icon image next to the channel name. The script links the image to the RSS feed of the YouTube channel. (This RSS icon image works seamlessly as it is from Google and is used in its “News” pages.) The Greasemonkey script also adds an RSS link tag to the HTML HEAD section so that browser applications can activate their RSS feed toolbar button.

A YouTube channel listing in the Bamboo RSS feed reader (a Firefox add-on or extension).

RSS provides an easier way to check Youtube channels. All that matters to YouTube is that people see their ads. RSS does not block ads and so no problem. Viewers who rely on subscriptions are likely to miss new but not so fresh videos if they don’t log in regularly. (Such videos get folded/wrapped/hidden as newer videos are published.) YouTube RSS feeds can ensure that viewers are more likely to get to know about the existence of a new video.

And, to use this script, you will need the Greasemonkey add-on in the browser. It can be installed from the Firefox/Seamonkey browser add-on search page (Tools – Add-ons from the main menu).

This article has been submitted to .

Advertisements

How to download & play YouTube videos offline using Subhash Browser app for Android

Youtube videos don’t play in any of my Android devices, that is, in the browsers. I think their Javascript tries to launch the YouTube app and remains stuck there (because I delete/disable all Google apps).

Fortunately, my app has a Javasript script which lets me download the videos as a file for offline viewing.

http://www.vsubhash.com/article.asp?id=126&info=Subhash_Browser_ultimate_browser_and_RSS_feed_reader_app_for_Android

Twitter Tweets Deleter 2016 – User JS for Opera 12.x and Firefox

This User JS will automatically delete all tweets in a Twitter account. Make sure you don’t let it run by mistake.

// ==UserScript==
// @name Twitter Tweets Deleter
// @namespace com.vsubhash.js.twitter.tweets.deleter
// @description Deletes all tweets one-by-one
// @version 1
// @grant none
// ==/UserScript==
document.addEventListener("DOMContentLoaded", startDeletingTweets, false); 
 
 
var iVsJsTimeout1, iVsJsTimeout2, bFoundRetweet = false; 
 

function startDeletingTweets() {
  window.setInterval(find_A_DotDot_Button, 12000);
}


function find_A_DotDot_Button() {
  console.error("Finding the dot-dot button");
  var i, oButtons = document.getElementsByTagName("span");
  
  for (i = 0; i  0) { window.clearTimeout(iVsJsTimeout1); }        
      iVsJsTimeout1 = window.setTimeout(click_Delete_MenuOption, 3000);
      break;
    }
  }
}

function click_Delete_MenuOption() {
  var i, oDeleteMenuButtons = document.getElementsByTagName("button"), bFoundOne = false;
  
  for (i = 0; i  0) { window.clearTimeout(iVsJsTimeout2); }        
        iVsJsTimeout2 = window.setTimeout(click_Delete_Button, 3000);
        bFoundOne = true;
        break; 
      }
    }
  }
  if (!bFoundOne) {
    var oRetweetButtons = document.getElementsByTagName("span");
    for (i = 0; i < oRetweetButtons.length; i++) {
      if (oRetweetButtons[i].className == "Icon Icon--retweet") {
        console.error("found retweet");
        oRetweetButtons[i].click();
        location.reload();
        break;
      }
    }
  }
}

function click_Delete_Button() {
  var i, oDeleteButtons = document.getElementsByTagName("button");
  
  for (i = 0; i < oDeleteButtons.length; i++) {
    if (oDeleteButtons[i].className == "btn primary-btn delete-action") {
      if (oDeleteButtons[i].textContent == "Delete") {
        console.error("Found a delete confirm button");
        oDeleteButtons[i].click();
        break;
      }
    }
  }
}

Download Any YouTube Video From Anywhere 2016 – User JS for Opera 12.x, Firefox and Android

SCREENSHOT-Subhash-Browser-YouTube-Video-DownloadMy Internet connection does not allow me to play videos live. I need to download them first and then play them. I used to use a FireFox extension called Download YouTube as FLV and MP4 for this. However, my primary browser is Opera 12.x. Today, I decided to write a User JS that would provide the same functionality in Opera 12.x. (The Opera browser company does not provide 12x anymore. They sold out and provide a crappy Chrome imitation.) UPDATE: I adapted this script for my Android browser app and also created a Greasemonkey version for Firefox. On Youtube pages, it displays a drop-down list with download options in various formats. On other pages that have inline videos, it adds a download button. (Check http://softwarerecs.stackexchange.com/questions/817/software-to-download-youtube-videos-to-hard-drive/32132#32132)

Facebook Posts Deleter 2016 – User JavaScript for Opera 12.x and Firefox

Clean out your Facebook activity log with Facebook Posts Deleter 2016!

There is a Greasemonkey script called Facebook Timeline Cleaner, which has not been updated and does not work anymore. So, I created my own User JS for Opera and later adapted it for Firefox. I am not wholly satisfied with this script as it uses recursion. But, it does work. See this video. It is extremely gratifying to see Facebook posts get deleted mercilessly.

// ==UserScript==
// @name        Facebook Posts Deleter
// @namespace   com.vsubhash.js.facebook.posts.deleter
// @description Deletes all facebook posts
// @version     1
// @grant       none
// ==/UserScript==
 
document.addEventListener("DOMContentLoaded", addFacebookPostsDeleteButton, false);
 
var oMvFbTimeout1, oMvFbTimeout2, oMvFbTimeout3;
  
 
function deleteTimelinePosts() {
  var i, j, k;
   
   
  if (document.getElementsByClassName("fbTimelineLogStream").length > 0) {  
    // console.error("Found a stream DIV");
    for (n = 0; n < document.getElementsByClassName("fbTimelineLogStream").length; n++) {
      var oStreamDiv = document.getElementsByClassName("fbTimelineLogStream")[n];
      for (i = 0; i < oStreamDiv.getElementsByTagName("div").length; i++) {
        // console.error("Class name of DIV" + oStreamDiv.getElementsByTagName("div")[i].className);
        if ((oStreamDiv.getElementsByTagName("div")[i].className.indexOf("pam") != -1) &&
            (oStreamDiv.getElementsByTagName("div")[i].className.indexOf("uiBoxWhite") != -1) &&
            (oStreamDiv.getElementsByTagName("div")[i].className.indexOf("bottomborder") != -1)) {
          // console.error("Found a post DIV in the stream DIV");      
          var oPostDiv = oStreamDiv.getElementsByTagName("div")[i];
          if (oPostDiv.getElementsByTagName("table").length > 0) {
            if (oPostDiv.getElementsByTagName("table")[0].getElementsByTagName("td").length == 3) {
             // console.error("Found a table in the post DIV");              
              var oCell = oPostDiv.getElementsByTagName("table")[0].getElementsByTagName("td")[2];
              var oCellMenuLink = oCell.getElementsByTagName("div")[0].getElementsByTagName("div")[0].getElementsByTagName("a")[0];
              oCellMenuLink.click();
              clickDelete();
              return;
            }
          }
        }      
      }
    }
  }  
}
 
function clickDelete() {
  var oMenuItems = document.getElementsByClassName("__MenuItem");
 
  for (var i = 0; i < oMenuItems.length; i++) {
 
    if (oMenuItems[i].getElementsByTagName("a").length > 0) {
      var oMenuItemLink = oMenuItems[i].getElementsByTagName("a")[0];
      if (oMenuItemLink.getAttribute("ajaxify").indexOf("/ajax/timeline/delete/confirm") != -1) {
       // console.error("Ajaxify " + oMenuItemLink.getAttribute("ajaxify"));      
        oMenuItemLink.style.backgroundColor = "orange";
        if (oMvFbTimeout2 != null) { window.clearTimeout(oMvFbTimeout2); }
        oMvFbTimeout2 = window.setTimeout(
          function() { 
            var oForms = document.getElementsByTagName("form");
 
            for (var j = 0; j < oForms.length; j++) {
              if (oForms[j].getAttribute("action").indexOf("/ajax/timeline/delete") != -1) {
                var oButtons = oForms[j].getElementsByTagName("button");
                for (var k = 0; k < oButtons.length; k++) {
                  if (oButtons[k].textContent.indexOf("Delete Post") != -1) {                    
                     
                    if (oMvFbTimeout3 != null) { window.clearTimeout(oMvFbTimeout3); }
                    oMvFbTimeout3 = window.setTimeout(
                        function() {
                          // console.error("final call");
                          for (var l = 0; l < document.getElementsByTagName("a").length; l++) {                          
                            if ((document.getElementsByTagName("a")[l].getAttribute("action") == "cancel") &&
                                (document.getElementsByTagName("a")[l].className.indexOf("layerCancel") != -1)) {
                              // console.error("final call as");
                              document.getElementsByTagName("a")[l].style.backgroundColor = "orange";
                              document.getElementsByTagName("a")[l].click();
                            }
                          }  
                        },
                        2000);
                    oButtons[k].click();                    
                  }
                }
              }    
            }            
          }, 
          7000);
        if (oMvFbTimeout1 != null) { window.clearTimeout(oMvFbTimeout1); }
        oMvFbTimeout1  = window.setTimeout(function () { deleteTimelinePosts() }, 12000);
        oMenuItemLink.click();   
 
      }          
    } 
  }
}
 
function addFacebookPostsDeleteButton() {  
  var oBody = document.getElementsByTagName("body")[0];
  var oInjectDiv = document.createElement("div");
  oInjectDiv.setAttribute("style", "position: absolute; top: 0; left: 0; background-color: rgba(50,150,30, 0.5); width: 190px; height: 50px; z-index: 333!important; ");
  oInjectDiv.innerHTML = "<input id='MvDelButton' type='button' value='Delete Facebook Posts' />";    
  oBody.insertBefore(oInjectDiv, oBody.childNodes[0]);
  document.getElementById("MvDelButton").addEventListener("click", deleteTimelinePosts, false);  
}) != -1) {
                var oButtons = oForms[j].getElementsByTagName(

This source is also available at: https://gist.github.com/vsubhash/

[This post was updated in 2016]