fix linkvertise using bypass.city

This commit is contained in:
Amm0ni4 2024-10-16 13:14:18 +02:00
parent cd8b61a133
commit f0cad8b1bb
3 changed files with 6 additions and 176 deletions

View file

@ -4,7 +4,7 @@
// @run-at document-start
// @author Amm0ni4
// @noframes
// @version 92.8.26
// @version 92.8.27
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_addStyle

View file

@ -4,7 +4,7 @@
// @run-at document-start
// @author Amm0ni4
// @noframes
// @version 92.8.26
// @version 92.8.27
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_addStyle
@ -2652,7 +2652,6 @@
// ----- ----- -----
// ----- Bypass Linkvertise ------
(function() {
'use strict';
@ -2665,94 +2664,11 @@
window.location.assign(atob(rParam));
// hard case
// (based on fix by harryitz: https://github.com/FastForwardTeam/FastForward/commit/31bd3b0193e06b73d8c777d640b0970175bac816#diff-4b960ee94677b8b7a092fdc10412fcf4df7c1eeea35347ce95b8540f1b9eda60)
} else {
// Function to handle the redirect logic
async function handleRedirect(data) {
if (data.currentTarget?.responseText?.includes('getDetailPageContent')) {
const response = JSON.parse(data.currentTarget.responseText);
const access_token = response.data.getDetailPageContent.access_token;
const ut = localStorage.getItem('X-LINKVERTISE-UT');
const linkvertise_link = location.pathname.replace(/\/[0-9]$/, '');
const regexMatch = linkvertise_link.match(/^\/(\d+)\/([\w-]+)$/);
if (!regexMatch) return;
const user_id = regexMatch[1];
const link_vertise_url = regexMatch[2];
// Bypass using Bypass.city API
window.location.assign('https://adbypass.org/bypass?bypass=' + window.location.href);
const completeDetailRequest = await fetch(
`https://publisher.linkvertise.com/graphql?X-Linkvertise-UT=${ut}`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'operationName': 'completeDetailPageContent',
'variables': {
'linkIdentificationInput': {
'userIdAndUrl': {
'user_id': user_id,
'url': link_vertise_url
}
},
'completeDetailPageContentInput': {
'access_token': access_token
}
},
'query': 'mutation completeDetailPageContent($linkIdentificationInput: PublicLinkIdentificationInput!, $completeDetailPageContentInput: CompleteDetailPageContentInput!) {\n completeDetailPageContent(\n linkIdentificationInput: $linkIdentificationInput\n completeDetailPageContentInput: $completeDetailPageContentInput\n ) {\n CUSTOM_AD_STEP\n TARGET\n additional_target_access_information {\n remaining_waiting_time\n can_not_access\n should_show_ads\n has_long_paywall_duration\n __typename\n }\n __typename\n }\n}'
})
});
if (completeDetailRequest.status !== 200) return;
const completeDetailResponse = await completeDetailRequest.json();
const TARGET = completeDetailResponse.data.completeDetailPageContent.TARGET;
if (!TARGET) return;
const getTargetPageRequest = await fetch(
`https://publisher.linkvertise.com/graphql?X-Linkvertise-UT=${ut}`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'query': 'mutation getDetailPageTarget($linkIdentificationInput: PublicLinkIdentificationInput!, $token: String!) {\n getDetailPageTarget(\n linkIdentificationInput: $linkIdentificationInput\n token: $token\n ) {\n type\n url\n paste\n short_link_title\n __typename\n }\n}',
'variables': {
'linkIdentificationInput': {
'userIdAndUrl': {
'user_id': user_id,
'url': link_vertise_url
}
},
'token': TARGET
}
})
}
);
if (getTargetPageRequest.status !== 200) return;
const targetPageResponse = await getTargetPageRequest.json();
const targetPageURL = targetPageResponse['data']['getDetailPageTarget']['url'];
if (targetPageURL === null || !targetPageURL || targetPageURL.trim() === "") {
window.location.href = 'https://adbypass.org/bypass?bypass=' + window.location.href;
} else {
window.location.href = targetPageURL;
}
}
}
// Function to intercept XHR requests
function interceptXHR() {
const open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
this.addEventListener("load", function(data) {
handleRedirect(data);
});
open.apply(this, arguments);
};
}
// Run the XHR interceptor
interceptXHR();
}
}

View file

@ -1,12 +1,9 @@
// ==UserScript==
// @name Linkvertise Bypass
// @author harryitz
// @description https://github.com/FastForwardTeam/FastForward/commit/31bd3b0193e06b73d8c777d640b0970175bac816#diff-4b960ee94677b8b7a092fdc10412fcf4df7c1eeea35347ce95b8540f1b9eda60
// @include /^(https?:\/\/)(?!(bypass.city|adbypass.org))(linkvertise.com|(linkvertise|link-to).net)/
// @run-at document-start
// ==/UserScript==
// ----- Bypass Linkvertise ------
(function() {
'use strict';
@ -19,94 +16,11 @@
window.location.assign(atob(rParam));
// hard case
// (based on fix by harryitz: https://github.com/FastForwardTeam/FastForward/commit/31bd3b0193e06b73d8c777d640b0970175bac816#diff-4b960ee94677b8b7a092fdc10412fcf4df7c1eeea35347ce95b8540f1b9eda60)
} else {
// Function to handle the redirect logic
async function handleRedirect(data) {
if (data.currentTarget?.responseText?.includes('getDetailPageContent')) {
const response = JSON.parse(data.currentTarget.responseText);
const access_token = response.data.getDetailPageContent.access_token;
const ut = localStorage.getItem('X-LINKVERTISE-UT');
const linkvertise_link = location.pathname.replace(/\/[0-9]$/, '');
const regexMatch = linkvertise_link.match(/^\/(\d+)\/([\w-]+)$/);
if (!regexMatch) return;
const user_id = regexMatch[1];
const link_vertise_url = regexMatch[2];
// Bypass using Bypass.city API
window.location.assign('https://adbypass.org/bypass?bypass=' + window.location.href);
const completeDetailRequest = await fetch(
`https://publisher.linkvertise.com/graphql?X-Linkvertise-UT=${ut}`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'operationName': 'completeDetailPageContent',
'variables': {
'linkIdentificationInput': {
'userIdAndUrl': {
'user_id': user_id,
'url': link_vertise_url
}
},
'completeDetailPageContentInput': {
'access_token': access_token
}
},
'query': 'mutation completeDetailPageContent($linkIdentificationInput: PublicLinkIdentificationInput!, $completeDetailPageContentInput: CompleteDetailPageContentInput!) {\n completeDetailPageContent(\n linkIdentificationInput: $linkIdentificationInput\n completeDetailPageContentInput: $completeDetailPageContentInput\n ) {\n CUSTOM_AD_STEP\n TARGET\n additional_target_access_information {\n remaining_waiting_time\n can_not_access\n should_show_ads\n has_long_paywall_duration\n __typename\n }\n __typename\n }\n}'
})
});
if (completeDetailRequest.status !== 200) return;
const completeDetailResponse = await completeDetailRequest.json();
const TARGET = completeDetailResponse.data.completeDetailPageContent.TARGET;
if (!TARGET) return;
const getTargetPageRequest = await fetch(
`https://publisher.linkvertise.com/graphql?X-Linkvertise-UT=${ut}`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'query': 'mutation getDetailPageTarget($linkIdentificationInput: PublicLinkIdentificationInput!, $token: String!) {\n getDetailPageTarget(\n linkIdentificationInput: $linkIdentificationInput\n token: $token\n ) {\n type\n url\n paste\n short_link_title\n __typename\n }\n}',
'variables': {
'linkIdentificationInput': {
'userIdAndUrl': {
'user_id': user_id,
'url': link_vertise_url
}
},
'token': TARGET
}
})
}
);
if (getTargetPageRequest.status !== 200) return;
const targetPageResponse = await getTargetPageRequest.json();
const targetPageURL = targetPageResponse['data']['getDetailPageTarget']['url'];
if (targetPageURL === null || !targetPageURL || targetPageURL.trim() === "") {
window.location.href = 'https://adbypass.org/bypass?bypass=' + window.location.href;
} else {
window.location.href = targetPageURL;
}
}
}
// Function to intercept XHR requests
function interceptXHR() {
const open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
this.addEventListener("load", function(data) {
handleRedirect(data);
});
open.apply(this, arguments);
};
}
// Run the XHR interceptor
interceptXHR();
}
}