Skip to content

Commit

Permalink
fixes for linkstaker and delete racatly
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Jul 5, 2020
1 parent 87699a5 commit f934522
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 73 deletions.
35 changes: 0 additions & 35 deletions src/libs/linkstaker.pw.ts

This file was deleted.

26 changes: 15 additions & 11 deletions src/libs/linkstaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,28 @@ export class LinkstakerResolver extends BaseUrlResolver {
title: 'title',
body: 'body@html'
});
var regex_link = /"file": "(https:[^"]*)"/g;
var link = regex_link.exec(obj.body)![1];
const regex_link = /("file": "(https:[^"]*)")|(\("download"\)\.src="([^"]*))/g;
const regex_link_result = regex_link.exec(obj.body);
const link = regex_link_result && (regex_link_result[2] || regex_link_result[4]);
if (link) {
var title = decodeURIComponent(obj.title).replace(/\+/g, ' ');
title = title.replace(' - Google Drive', '').trim();
var result = <ResolvedMediaItem>{
link: link,
title: title,
isPlayable: true
};
links.push(result);

var gdriveUrl = new URL(link);
if (gdriveUrl.hostname.toLowerCase().endsWith('googleusercontent.com')) {
console.log(`${_urlToResolve} : googleusercontent.com link found in the page, reconstructing the drive.google.com link.`);
const googleDocId = gdriveUrl.pathname.split('/').slice(-1)[0];
const constructedGoogleLInk = `https://drive.google.com/file/d/${googleDocId}/view`;
links.push({ link: constructedGoogleLInk, isPlayable: false } as ResolvedMediaItem);
} else {
var title = decodeURIComponent(obj.title).replace(/\+/g, ' ');
title = title.replace(' - Google Drive', '').trim();
var result = <ResolvedMediaItem>{
link: link,
title: title,
isPlayable: true
};
links.push(result);
}
} else {
console.log(`${_urlToResolve} : No valid link found in the page.`);
}
return links;
}
Expand Down
27 changes: 0 additions & 27 deletions src/libs/racaty.ts

This file was deleted.

0 comments on commit f934522

Please sign in to comment.