Chrome extension to hide distracting recommendations on YouTube

YouTube can be used not only for entertainment, but also for learning anything.


Recommendations on YouTube are very useful as they prompt relevant videos to the current one, but they are also dangerous because they also contain interesting and distracting videos (not related to the video).




At some point, you just get tired of watching videos on a certain topic, and here you are caught by distracting recommendations, because it’s more profitable for YouTube to attract any other content if you spend more time on it . Surf is thus wasting time in vain.


Proposed solution


You can separate accounts for YouTube (for training and for entertainment), but unfortunately this will not help from throwing in inappropriate videos, since the recommendation system learns not only from you, but from all users in principle, which means that everyone needs to follow this tactic .


Therefore, I decided that you can try to do something that will block non-thematic recommendations.


Idea implementation


The first thing that comes to mind is machine learning, text classification, etc.


. , — .


, "-" , .


chrome , , . , .



Chrome . manifest.json:


"content_scripts": [
    {
      "matches": ["https://www.youtube.com/*"],
      "css": ["styles.css"],
      "js": ["page-script.js"]
    }
],

, . :


//   
document.querySelector('h1'), 
//   
document.querySelector('#description'), 
//  
document.querySelectorAll('ytd-compact-video-renderer')

css , :


.youtube-stay-focused__blur {
    filter: blur(5px) grayscale(100%);
    opacity: 0.3;
}

.youtube-stay-focused__blur:hover {
    filter: none;
    opacity: 1;
}


, .



.


TF-IDF, BM25 , 0.




. , , ( ).


"" .



"":


  • , ..;
  • ;
  • "#", "$", ..;
  • , ;
  • ;
  • , trailer, audio, video ..;


:


"     ?" 
=> 
["", "", "", "", "", "", "?"]


- , .. :


, , , ,  => 

, . , , .


. npm . natural, https://www.npmjs.com/package/natural, nodejs ( fshttps://www.npmjs.com/package/fs), !


const porterStemmerRu = require('natural/lib/natural/stemmers/porter_stemmer_ru');
const porterStemmer = require('natural/lib/natural/stemmers/porter_stemmer');
// ...
const stem = (words) =>
  words
    .map((word) => porterStemmerRu.stem(word))
    .map((word) => porterStemmer.stem(word));


"     ?"
=>
["", "", "", "", ""]

.


.



Chrome YouTube.




.


Published in the official chrome market, you can install and try how it works right now:
https://chrome.google.com/webstore/detail/youtube-stay-focused/enhfmpfmofdnhelhegdjanoaomlcieen


Who knows how to make better welcome in the comments or in the contributors;)


Appreciate your time.


All Articles