Open mholtstrom opened 7 months ago
Yes, that's exactly what this is for.
You set up a password, then when you try to view a video on YouTube it will block it and display a popup.
The popup allows you to unblock the specific video, the playlist, the entire channel or the whole of YouTube. You can optionally set a time limit for the access to expire. You cannot unblock the whole of YouTube without setting an expiry (otherwise the whole thing would be pointless).
My work on out has been a bit chaotic as I hadn't expected anyone else to show any interest and it's mostly serving my purposes at the moment.
Also, the whole proposition of making an extension like this is like wrestling with an octopus, as the YT web app is constantly updating the page and the the extension is detecting the changes and reacting to them without a clean way to know when a set of chsngesv is complete.
I could probably tidy it up so it's ready for you in a few days.
The main issues at the moment are:
YouTube shorts don't work great. It does the job of blocking all videos that you haven't whitelisted, but it can get confused and block videos that it should allow if you skip back and forward through them.
The settings page is pretty janky.
So a question to you:
What do you want to do with YouTube shorts? I imagine that you might want to just turn them off completely.
PS. Your kid's school looks cool. I'm an oddball homeschooler who likes to set his kids on advanced / self directed learning.
I've updated the repo. It should provide the features that you are looking for.
I hadn't discovered the extensions that you mention in your blog post. Those all look like they are rather more polished and have better code quality than this extension but on the other hand this extension was written to do exactly what I want (limit access by whitelist).
Thanks for the detailed reply. You're right, I'd prefer to turn off shorts completely. Thanks for the repo update. I haven't used TypeScript before. Would you be willing to upload your dist folder? I think I'll have to install Node or something in order to produce the .js myself.
I'm currently using YouTube Blocker (app1) but it doesn't filter shorts and I dislike that I can't see the source.
safetube replied to my comment with good advice but doesn't provide a whitelist solution.
YouTube-Blocker (app2) replied to my comment with lots of good advice, but he's busy converting to manifest v3, so I think you're my best bet. It looks like his strategy is to listen to onHistoryStateUpdated
and check if the url is for an approved youtube video. I haven't tested it but I don't see how that can block embedded videos. Maybe they generate their own onHistoryStateUpdated
.
// notifiy content script when youtube dynamically updates DOM to prevent re fetching API
chrome.webNavigation.onHistoryStateUpdated.addListener(function(details) {
console.log('page updated')
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {query: "Page updated"}, function(response) {
});
});
})
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
if (request.query === 'Page updated')
{
let currentUrl = location.href;
if (prevUrls.includes(currentUrl)) {
console.log('--------- Url already fetched.Not fetching again. ---------')
return;
}
prevUrls.push(currentUrl);
console.log("Initiating Youtube Study for new url: " + currentUrl);
chrome.runtime.sendMessage({url: currentUrl}, function(response) {
console.log("-------Response from send url message: -----------");
processYoutubeData(response.json, blockYoutubeUrl)
});
}
});
There is now a release with a built version of the plugin so you can just unzip the file instead of cloning the repo and building it.
I've tested this on my PC and it works great. Thanks. I have a few requests and suggestions.
youtube-warden-0.0.1.zip contains an empty /dist/assets/ so the extension fails to load until I download icon.png and place it in that location. If you post this extension to the store, you'll need to fix that first.
In YouTubeWarden extension options there is a button to reset the master password. I suggest to remove this feature. If someone forgets their password they can remove and re-add the extension. While this feature is accessible my child can reset the password, choose their own, and access arbitrary videos. From your Limitations section I see that you work around this by blocking access to chrome://extensions/ but I don't see this as desirable on a child's (i.e. SupervisedUser) ChromeOS. I would prefer if the "reset the master password" button just didn't exist. I realize that will leave me with the problem of her removing the YouTubeWarden extension, but since she can't add it back without my authentication, I'll notice and I think that (combined with the consequence of blocking all of YouTube via FamilyLink) will be sufficient to keep the extension in place.
I want to use this on my child's ChromeOS, but in that case it seems to be not possible to toggle the extension manager to developer mode and to load unpacked extensions. I've noticed similar restrictions on her PC like you can't inspect source on websites. Even if this can be worked around I think I'd prefer to keep those restrictions in place. Would you be willing to post your extension to the Chrome store? If not, would you mind if I posted it so that I can consume it on her laptop.
For reference, here are my notes from the last time I posted an extension to the store:
Go to the Chrome Developer Dashboard
https://chrome.google.com/webstore/developer/dashboard
Select your extension
> Package > Upload new package > app_v1.7.zip
That takes you to "Store Listing"
Description: ...
Category: Accessibility
Language: English
Store icon: 128x128
Screenshots: home-at-top-right-screen-shot_1200_800.ppng
Official URL: http://holtstrom.com/michael/
Homepage URL: https://holtstrom.com/michael/blog/post/412/Home-Button-At-Top-Right-Chrome-Extension.html
Support URL: https://holtstrom.com/michael/blog/post/412/Home-Button-At-Top-Right-Chrome-Extension.html
Mature content: False
Save draft
Privacy
Single purpose: Provides a button at the top-right of Chrome that links to any pages.
Permission justification: Remember user settings: Redirect Urls. Icon Style.
No, I am not using remote code.
Collect nothing.
Sell nothing.
Privacy Policy URL: https://holtstrom.com/michael/blog/post/412/Home-Button-At-Top-Right-Chrome-Extension.html
Save draft
Distribution
Free
Public
Everywhere
Save draft
Submit for review
In your case I think you could use your youtube-warden readme as the link for all the required URLs in the chrome store submission.
I suggest linking both from the chrome store description to your github page and from the github readme to the chrome store page, so that a user who finds either can know the other exists.
I also suggest adding some screenshots to the readme so that users can know what the extension does before the download/install it. Something like this:
By installing YouTube Warden you grant access for the extension to view and modify all your activity on youtube.com (excluding music.youtube.com). The first time you visit a YoutTube page you will get a password prompt like this:
Once you've set a password, you can browse YouTube normally, but when you attempt to view a video it will be blocked with a prompt like this:
You can allow specific videos and/or channels indefinitely or for limited times. Your selections an be later changed in the extensions options page. These restrictions only apply to YouTube videos viewed from the YouTube website in your browser. They don't apply to YouTube videos embedded in other websites like Ted-Ed:
This extension works very well for limiting a child's access to educational videos on ChromeOS with a Supervised User account using FamilyLink. In that scenario, you can grant access via FamilyLink to sites like Ted-Ed but in order for you child to view the embedded video content you must also grant access via FamilyLink to all of YouTube. This means your child could visit YouTube and access arbitrary videos. The access controls provided by YouTube and FamilyLink don't enable you to permit only specific channels. By installing YouTube Warden you can limit access to specific channels, therefore making it possible for your child to visit Ted-Ed without also granting unlimited access to non-educational videos. Of course this also applies to educational channels like Kurzgesagt which don't have an independent website. Your child can still browse and access all the YouTube channels that you have permitted.
@maninalift I'm a developer who wants to configure his 7-year-old's ChromeBook (that is controlled via FamilyLink) to only be able to browse and play videos based on a whitelist of channels (like TedEd). From my investigation so far, this isn't supported by Google/Chromebook/FamilyLink/YouTube. A chrome extension seems like my best bet. My full analysis is at https://holtstrom.com/michael/blog/post/735/Internet-for-Kids.html And you can reach me at [chromeapps at holtstrom.com] It looks like you're actively building what I want. Please let me know when you expect to have a release and if it will match my needs. I'm happy to help you test and/or develop. If you don't expect to complete soon or if I've misunderstood your intentions, I'll develop my own. Let me know. Thanks.