-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
44 lines (37 loc) · 1.21 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// @ts-nocheck
import pgk from "./package.json"
import defaults from "./src/defaults";
import consts from "./src/consts";
import axios from "axios";
export default class Sourcefinder {
private useragent: string
constructor(useragent?: string) {
this.useragent = useragent ? `${useragent} ${consts.useragent}` : consts.useragent
}
async find(content: string) {
let Links = content.match(consts.md5)
if (!Links) return;
let Sources: string[] = []
for (const Index in Links) {
let ImageURL = Links[Index]
let ImageHash = ImageURL.split(consts.md5)[2]
let { data } = await axios.get(`${consts.search_url}${ImageHash}`,
{
headers: {
"User-Agent": this.useragent
}
})
let source: string
switch (data.post.rating) {
case "s":
source = `${consts.enine}${data.post.id}`
break;
default:
source = `${consts.esix}${data.post.id}`
break;
}
Sources.push(source)
}
return Sources
}
}