-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
39 lines (38 loc) · 1.48 KB
/
content.js
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
// CommonJS 모듈 시스템을 사용할 수 없는 브라우저 환경을 위해 전역 객체를 사용합니다.
const utils =
typeof window !== "undefined" ? window.utils : require("./src/utils.js");
const linkedin =
typeof window !== "undefined"
? window.linkedin
: require("./src/linkedin.js");
const remember =
typeof window !== "undefined"
? window.remember
: require("./src/remember.js");
const google =
typeof window !== "undefined" ? window.google : require("./src/google.js");
// 다른 testing 환경에서 호출 가능하게 (import 가능하게)
if (typeof chrome !== "undefined" && chrome.runtime) {
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === "startLinkedinScraping") {
utils.logVersion();
linkedin.scrapeLinkedInData(message.count, message.sleep);
} else if (message.action === "startLinkedinTargetScraping") {
utils.logVersion();
linkedin.scrapeTargetLinkedInData(message.userUrn);
} else if (message.action === "startLinkedinScrapingStream") {
utils.logVersion();
linkedin.scrapeLinkedInDataAndUploadStream(message.sleep);
} else if (message.action === "startRememberScraping") {
utils.logVersion();
remember.scrapeRememberData(
message.token,
message.userAgent,
message.totalPageCount
);
} else if (message.action === "googleUrlScraping") {
utils.logVersion();
google.scrapeGoogleUrlData();
}
});
}