{"id":20269383,"url":"https://github.com/thammami01/youtube-ad-blocker","last_synced_at":"2025-04-11T04:01:28.139Z","repository":{"id":49312565,"uuid":"507821288","full_name":"THammami01/youtube-ad-blocker","owner":"THammami01","description":"Extension for Chromium-based broswers that skips video ads and hides other 5+ types of banner ads on YouTube, as well as displays statistics. (STOPPED WORKING AFTER YOUTUBE LAST UPDATE!)","archived":false,"fork":false,"pushed_at":"2024-05-06T10:24:15.000Z","size":375,"stargazers_count":14,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T02:01:37.815Z","etag":null,"topics":["ad-blocker","chrome-extension","collaborate","communityexchange","github","student-vscode","tailwindcss","vanilla-js","youtube"],"latest_commit_sha":null,"homepage":"https://chrome.google.com/webstore/detail/youtube-ad-blocker/iiiilpabaoapcpklalifahaloiejiaio","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/THammami01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-27T08:16:29.000Z","updated_at":"2025-02-01T18:59:05.000Z","dependencies_parsed_at":"2024-11-14T12:38:09.316Z","dependency_job_id":null,"html_url":"https://github.com/THammami01/youtube-ad-blocker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THammami01%2Fyoutube-ad-blocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THammami01%2Fyoutube-ad-blocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THammami01%2Fyoutube-ad-blocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THammami01%2Fyoutube-ad-blocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/THammami01","download_url":"https://codeload.github.com/THammami01/youtube-ad-blocker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339256,"owners_count":21087214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ad-blocker","chrome-extension","collaborate","communityexchange","github","student-vscode","tailwindcss","vanilla-js","youtube"],"created_at":"2024-11-14T12:24:46.398Z","updated_at":"2025-04-11T04:01:28.107Z","avatar_url":"https://github.com/THammami01.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Youtube Ad Blocker\n\n## Overview\n\nExtension for Chromium-based broswers that skips video ads and hides other 5+ types of banner ads on YouTube, as well as displays statistics for what was skipped (number and duration per past day, month and the total).\n\n\u003cimg src=\"illustration.png\" alt=\"YAB Illustration\" width=\"500\" /\u003e\n\n## Notes\n\n### Base\n\nTo skip a video ad:\n\n```js\nconst video = document.getElementsByClassName(\"video-stream\")[0];\nvideo.currentTime = video.duration;\ndocument.getElementsByClassName(\"ytp-ad-skip-button\")[0].click();\n```\n\nThe last line of code might be sufficient for the \"5s must-watch\" ads.\n\n### Scripts\n\nThere are three scripts and here is the utility of each one:\n\n1. `script.js`\n\n   - Contains the popup's logic.\n   - Retrieves data displayed in the popup from local storage.\n   - Notifies all YouTube tabs when the extension is enabled/disabled.\n\n2. `service-worker.js`\n\n   - Always running in the background;\n     - Either active or inactive, with inactivity for approximately 10 seconds resulting in an inactive state.\n     - Becomes active again upon receiving a message.\n   - Listens for messages from `content-script.js`.\n   - Has access to the extension's local storage and updates it when a message is received.\n   - Runs event listeners callback functions immediately upon receiving a message.\n\n3. `content-script.js`\n   - Injected into the YouTube website.\n   - Blocks all types of ads;\n     - Skips must-be-watched ads.\n     - Hides banner ads.\n   - Sends messages containing the details of skipped ads to `content script.js`.\n   - Displays an alert, prompting for a page reload, when the popup's toggle switch is turned on/off.\n\n```mermaid\ngraph RL;\nCSA(Chrome Storage API)\ncontent-script.js--\u003eservice-worker.js;\nservice-worker.js--\u003econtent-script.js;\nservice-worker.js--\u003eCSA;\nCSA--\u003escript.js;\nscript.js--\u003econtent-script.js;\n```\n\n### Types of Ads\n\n1. Appears on the homepage.\n2. Appears on top of the suggested list of videos.\n3. Appears under the video description.\n4. Skippable 5-second-must-be-watched video ad at the beginning, middle, or end of a video.\n5. Similar to Type 4, but with two consecutive video ads.\n6. Unskippable 10-second-must-be-watched video ad.\n\nAnd more discovered when using a VPN across multiple countries.\n\n### Additional Details\n\n- All data are saved in local storage, making it a standalone app.\n- The manifest is version 3 and can be deployed to the Chrome Web Store without any code updates.\n- Code is formatted using Prettier default style guides.\n- Flowbite UI components, based on Tailwind CSS, are used.\n\n## Todos\n\n- Address extension issues with video ads to make it work with the latest YouTube updates.\n\n## Extension Preview\n\n\u003cimg src=\"popup.png\" alt=\"YAB Popup\" width=\"600\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthammami01%2Fyoutube-ad-blocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthammami01%2Fyoutube-ad-blocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthammami01%2Fyoutube-ad-blocker/lists"}