Add support for reurl.cc
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import axios from 'axios';
|
||||
import cheerio from 'cheerio';
|
||||
|
||||
const fetchTarget = async (target: string) => {
|
||||
return await axios.get(target, {
|
||||
maxRedirects: 0,
|
||||
validateStatus: (status) => {
|
||||
return status >= 300 && status < 400;
|
||||
return status >= 200 && status < 400;
|
||||
},
|
||||
});
|
||||
};
|
||||
@ -16,6 +17,12 @@ export const getLocationOfTarget = async (target: string) => {
|
||||
if (response.headers.location) {
|
||||
return response.headers.location as string;
|
||||
}
|
||||
|
||||
// for reurl.cc
|
||||
if (target.includes('reurl.cc')) {
|
||||
const $ = cheerio.load(response.data);
|
||||
return $('#url').attr('value');
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
|
Reference in New Issue
Block a user