mirror of
https://github.com/primedigitaltech/azon_seeker.git
synced 2026-01-19 13:13:22 +08:00
No way for Narcissus
This commit is contained in:
parent
0059f8246b
commit
18ad1332db
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
@ -10,14 +10,7 @@
|
|||||||
"name": "Attach to side panel",
|
"name": "Attach to side panel",
|
||||||
"webRoot": "${workspaceFolder}/src/",
|
"webRoot": "${workspaceFolder}/src/",
|
||||||
"port": 9222,
|
"port": 9222,
|
||||||
"urlFilter": "chrome-extension://fmalpbpehdilmjhnanhpjmnkgbahopfj/*"
|
"urlFilter": "chrome-extension://ajeifjaabhkjdiedhpagcpihkgjelhaa/*"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "msedge",
|
|
||||||
"request": "attach",
|
|
||||||
"name": "Attach to Amazon",
|
|
||||||
"port": 9222,
|
|
||||||
"urlFilter": "https://www.amazon.com/*"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "azon-seeker",
|
"name": "azon-seeker",
|
||||||
"displayName": "Azon Seeker",
|
"displayName": "Azon Seeker",
|
||||||
"version": "0.7.0",
|
"version": "0.7.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Starter modify by honestfox101",
|
"description": "Starter modify by honestfox101",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"build:background": "vite build --config vite.config.background.mts",
|
"build:background": "vite build --config vite.config.background.mts",
|
||||||
"build:web": "vite build",
|
"build:web": "vite build",
|
||||||
"build:js": "vite build --config vite.config.content.mts",
|
"build:js": "vite build --config vite.config.content.mts",
|
||||||
"pack:7z": "rimraf --glob ./build/*.7z && 7z a ./build/extension.7z extension/* && 7z a ./build/extension-firefox.7z extension-firefox/*",
|
"pack:7z": "rimraf --glob ./build/*.7z && esno scripts/pack.ts",
|
||||||
"start:chromium": "web-ext run --source-dir ./extension --target=chromium --chromium-binary 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'",
|
"start:chromium": "web-ext run --source-dir ./extension --target=chromium --chromium-binary 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'",
|
||||||
"start:firefox": "web-ext run --source-dir ./extension-firefox --target=firefox-desktop",
|
"start:firefox": "web-ext run --source-dir ./extension-firefox --target=firefox-desktop",
|
||||||
"clear": "rimraf --glob extension/dist extension/manifest.json extension.* ",
|
"clear": "rimraf --glob extension/dist extension/manifest.json extension.* ",
|
||||||
@ -26,6 +26,7 @@
|
|||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"7zip-min": "^2.1.0",
|
||||||
"@iconify/json": "^2.2.359",
|
"@iconify/json": "^2.2.359",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/gulp-terser": "^1.2.6",
|
"@types/gulp-terser": "^1.2.6",
|
||||||
|
|||||||
21
pnpm-lock.yaml
generated
21
pnpm-lock.yaml
generated
@ -7,6 +7,9 @@ settings:
|
|||||||
importers:
|
importers:
|
||||||
.:
|
.:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
7zip-min:
|
||||||
|
specifier: ^2.1.0
|
||||||
|
version: 2.1.0
|
||||||
'@iconify/json':
|
'@iconify/json':
|
||||||
specifier: ^2.2.359
|
specifier: ^2.2.359
|
||||||
version: 2.2.359
|
version: 2.2.359
|
||||||
@ -132,6 +135,18 @@ importers:
|
|||||||
version: 0.12.0
|
version: 0.12.0
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
7zip-bin@5.1.1:
|
||||||
|
resolution:
|
||||||
|
{
|
||||||
|
integrity: sha512-sAP4LldeWNz0lNzmTird3uWfFDWWTeg6V/MsmyyLR9X1idwKBWIgt/ZvinqQldJm3LecKEs1emkbquO6PCiLVQ==,
|
||||||
|
}
|
||||||
|
|
||||||
|
7zip-min@2.1.0:
|
||||||
|
resolution:
|
||||||
|
{
|
||||||
|
integrity: sha512-6uoMmPaasBQOyEuMIuNnASA6mF6ZfNmhsKdxJiEbtkHt9DkrJ0w1cZwyNdkDeOKjR2c5gOQAEkvMN3gyZ9MEBw==,
|
||||||
|
}
|
||||||
|
|
||||||
'@alova/shared@1.3.1':
|
'@alova/shared@1.3.1':
|
||||||
resolution:
|
resolution:
|
||||||
{
|
{
|
||||||
@ -6114,6 +6129,12 @@ packages:
|
|||||||
engines: { node: '>= 10' }
|
engines: { node: '>= 10' }
|
||||||
|
|
||||||
snapshots:
|
snapshots:
|
||||||
|
7zip-bin@5.1.1: {}
|
||||||
|
|
||||||
|
7zip-min@2.1.0:
|
||||||
|
dependencies:
|
||||||
|
7zip-bin: 5.1.1
|
||||||
|
|
||||||
'@alova/shared@1.3.1': {}
|
'@alova/shared@1.3.1': {}
|
||||||
|
|
||||||
'@ampproject/remapping@2.3.0':
|
'@ampproject/remapping@2.3.0':
|
||||||
|
|||||||
17
scripts/pack.ts
Normal file
17
scripts/pack.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import _7z from '7zip-min';
|
||||||
|
import { basename } from 'path';
|
||||||
|
import { r, log } from './utils';
|
||||||
|
import packageJson from '../package.json';
|
||||||
|
|
||||||
|
const scriptPath = ['extension', 'extension-firefox'];
|
||||||
|
|
||||||
|
scriptPath.forEach(async (src) => {
|
||||||
|
const srcPath = r(src);
|
||||||
|
const distPath = r('build', `${basename(src)}-v${packageJson.version}.7z`);
|
||||||
|
try {
|
||||||
|
const output = await _7z.pack(srcPath, distPath);
|
||||||
|
log('Info', `stdout of the 7za command execution ${output}`);
|
||||||
|
} catch (err) {
|
||||||
|
log('Error', `${err}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -51,9 +51,12 @@ class HomedepotWorkerImpl
|
|||||||
await injector.waitForReviewLoad();
|
await injector.waitForReviewLoad();
|
||||||
let reviews = await injector.getReviews();
|
let reviews = await injector.getReviews();
|
||||||
reviews.length > 0 && (await this.emit('review-collected', { OSMID, reviews }));
|
reviews.length > 0 && (await this.emit('review-collected', { OSMID, reviews }));
|
||||||
while ((await injector.tryJumpToNextPage()) && reviews.length > 0) {
|
let goOn = await injector.tryJumpToNextPage();
|
||||||
|
while (goOn && reviews.length > 0) {
|
||||||
|
await injector.waitForReviewLoad();
|
||||||
reviews = await injector.getReviews();
|
reviews = await injector.getReviews();
|
||||||
reviews.length > 0 && (await this.emit('review-collected', { OSMID, reviews }));
|
reviews.length > 0 && (await this.emit('review-collected', { OSMID, reviews }));
|
||||||
|
goOn = await injector.tryJumpToNextPage();
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
browser.tabs.remove(tab.id!);
|
browser.tabs.remove(tab.id!);
|
||||||
|
|||||||
@ -178,18 +178,29 @@ export class HomedepotDetailPageInjector extends BaseInjector {
|
|||||||
|
|
||||||
public tryJumpToNextPage() {
|
public tryJumpToNextPage() {
|
||||||
return this.run(async () => {
|
return this.run(async () => {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
while (!document.querySelector<HTMLElement>('.pager__summary')) {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
}
|
||||||
const final = document.querySelector<HTMLElement>(
|
const final = document.querySelector<HTMLElement>(
|
||||||
'.pager__summary--bold:nth-last-of-type(2)',
|
'.pager__summary > span:nth-child(2)',
|
||||||
)!.innerText;
|
)!.innerText;
|
||||||
const anchor = document.querySelector<HTMLElement>(
|
const anchor = document.querySelector<HTMLElement>(
|
||||||
'.pager__summary--bold + .pager__summary--bold',
|
'.pager__summary > span:nth-child(3)',
|
||||||
)!.innerText;
|
)!.innerText;
|
||||||
if (final === anchor) {
|
if (final === anchor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const button = document.querySelector<HTMLElement>('[data-testid="pagination-Next"]');
|
let button = document.querySelector<HTMLElement>(
|
||||||
button!.click();
|
'[data-testid="pagination"] li:last-of-type a',
|
||||||
|
);
|
||||||
|
while (!button) {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
button = document.querySelector<HTMLElement>(
|
||||||
|
'[data-testid="pagination"] li:last-of-type a',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
button.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
button.click();
|
||||||
while (true) {
|
while (true) {
|
||||||
const newAnchor = document.querySelector<HTMLElement>(
|
const newAnchor = document.querySelector<HTMLElement>(
|
||||||
'.pager__summary--bold + .pager__summary--bold',
|
'.pager__summary--bold + .pager__summary--bold',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user