Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Fix #43 and the ratelimit bypasser
Browse files Browse the repository at this point in the history
  • Loading branch information
reisxd committed Jul 10, 2022
1 parent 1ff09cc commit 2c62d81
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function getDownloadLink (json) {
);
const jsonResponse = await apiRequest.json();
let assets = jsonResponse?.assets;
if (jsonResponse.error) {
if (jsonResponse.error || !apiRequest.ok) {
const assetsGH = [];
const releasesPage = await fetchURL(
`https://github.com/${json.owner}/${json.repo}/releases/latest`
Expand Down Expand Up @@ -181,15 +181,22 @@ async function downloadYTApk (ytVersion) {
if (ytVersion) apkVersion = ytVersion.replace(/\./g, '-');
if (versionChoosen) apkVersion = versionChoosen.version.replace(/\./g, '-');

const versionDownload = await fetchURL(`https://www.apkmirror.com/apk/google-inc/youtube/youtube-${apkVersion}-release/`);
const versionDownload = await fetchURL(
`https://www.apkmirror.com/apk/google-inc/youtube/youtube-${apkVersion}-release/`
);
const versionDownloadList = await versionDownload.text();

const vDLL = load(versionDownloadList);
const dlLink = vDLL('span[class="apkm-badge"]').first().parent().children('a[class="accent_color"]').first().attr('href');
const dlLink = vDLL('span[class="apkm-badge"]')
.first()
.parent()
.children('a[class="accent_color"]')
.first()
.attr('href');

const downloadLink = await fetchURL(`https://www.apkmirror.com${dlLink}`);
const downloadLinkPage = await downloadLink.text();

const dlPage = load(downloadLinkPage);
const pageLink = dlPage('a[class^="accent_bg btn btn-flat downloadButton"]')
.first()
Expand Down Expand Up @@ -405,7 +412,8 @@ async function getYTVersion () {
console.log('Building ReVanced, please be patient!');

const { stdout, stderr } = await actualExec(
`java -jar ${jarNames.cli} -b ${jarNames.patchesJar} --experimental -a ./revanced/youtube.apk ${jarNames.deviceId} -o ./revanced/revanced.apk -m ${jarNames.integrations} ${excludedPatches}`
`java -jar ${jarNames.cli} -b ${jarNames.patchesJar} --experimental -a ./revanced/youtube.apk ${jarNames.deviceId} -o ./revanced/revanced.apk -m ${jarNames.integrations} ${excludedPatches}`,
{ maxBuffer: 5120 * 1024 }
);
console.log(stdout || stderr);

Expand Down Expand Up @@ -564,7 +572,8 @@ async function getYTVersion () {

console.log('Building ReVanced, please be patient!');
const { stdout, stderr } = await actualExec(
`java -jar ${jarNames.cli} -b ${jarNames.patchesJar} --experimental -a ./revanced/youtube.apk ${jarNames.deviceId} -o ./revanced/revanced.apk -m ${jarNames.integrations} ${patches}`
`java -jar ${jarNames.cli} -b ${jarNames.patchesJar} --experimental -a ./revanced/youtube.apk ${jarNames.deviceId} -o ./revanced/revanced.apk -m ${jarNames.integrations} ${patches}`,
{ maxBuffer: 5120 * 1024 }
);
console.log(stdout || stderr);

Expand Down

0 comments on commit 2c62d81

Please sign in to comment.