Skip to content

Commit

Permalink
New Version 🥳
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodytrash committed Jul 3, 2022
1 parent ea63d67 commit a79d34a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
28 changes: 15 additions & 13 deletions dist/Simple-YouTube-Age-Restriction-Bypass.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @description:de Schaue YouTube Videos mit Altersbeschränkungen ohne Anmeldung und ohne dein Alter zu bestätigen :)
// @description:fr Regardez des vidéos YouTube avec des restrictions d'âge sans vous inscrire et sans confirmer votre âge :)
// @description:it Guarda i video con restrizioni di età su YouTube senza login e senza verifica dell'età :)
// @version 2.5.1
// @version 2.5.2
// @author Zerody (https://github.com/zerodytrash)
// @namespace https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass/
// @supportURL https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass/issues
Expand Down Expand Up @@ -113,7 +113,6 @@

const nativeJSONParse = window.JSON.parse;
const nativeXMLHttpRequestOpen = window.XMLHttpRequest.prototype.open;
const nativeRequest = window.Request;

const isDesktop = window.location.host !== 'm.youtube.com';
const isMusic = window.location.host === 'music.youtube.com';
Expand Down Expand Up @@ -393,20 +392,23 @@
return;
}

window.Request = function (url, options) {
try {
let parsedUrl = parseRelativeUrl(url);
let modifiedUrl = onRequestCreate(parsedUrl, options);
window.Request = new Proxy(window.Request, {
construct(target, args) {
const [url, options] = args;
try {
const parsedUrl = parseRelativeUrl(url);
const modifiedUrl = onRequestCreate(parsedUrl, options);

if (modifiedUrl) {
arguments[0] = modifiedUrl.toString();
if (modifiedUrl) {
args[0] = modifiedUrl.toString();
}
} catch (err) {
error(err, `Failed to intercept Request()`);
}
} catch (err) {
error(err, `Failed to intercept Request()`);
}

return new nativeRequest(...arguments);
};
return Reflect.construct(...arguments);
},
});
}

function attach(onXhrOpenCalled) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "module",
"name": "simple-youtube-age-restriction-bypass",
"description": "A simple userscript to bypass YouTube's age verification and watch age restricted videos without having to sign in.",
"version": "2.5.1",
"version": "2.5.2",
"repository": {
"type": "git",
"url": "git+https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass.git"
Expand Down

0 comments on commit a79d34a

Please sign in to comment.