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",
|
||||
"webRoot": "${workspaceFolder}/src/",
|
||||
"port": 9222,
|
||||
"urlFilter": "chrome-extension://fmalpbpehdilmjhnanhpjmnkgbahopfj/*"
|
||||
},
|
||||
{
|
||||
"type": "msedge",
|
||||
"request": "attach",
|
||||
"name": "Attach to Amazon",
|
||||
"port": 9222,
|
||||
"urlFilter": "https://www.amazon.com/*"
|
||||
"urlFilter": "chrome-extension://ajeifjaabhkjdiedhpagcpihkgjelhaa/*"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "azon-seeker",
|
||||
"displayName": "Azon Seeker",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.1",
|
||||
"private": true,
|
||||
"description": "Starter modify by honestfox101",
|
||||
"scripts": {
|
||||
@ -17,7 +17,7 @@
|
||||
"build:background": "vite build --config vite.config.background.mts",
|
||||
"build:web": "vite build",
|
||||
"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:firefox": "web-ext run --source-dir ./extension-firefox --target=firefox-desktop",
|
||||
"clear": "rimraf --glob extension/dist extension/manifest.json extension.* ",
|
||||
@ -26,6 +26,7 @@
|
||||
"prepare": "husky"
|
||||
},
|
||||
"devDependencies": {
|
||||
"7zip-min": "^2.1.0",
|
||||
"@iconify/json": "^2.2.359",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/gulp-terser": "^1.2.6",
|
||||
|
||||
21
pnpm-lock.yaml
generated
21
pnpm-lock.yaml
generated
@ -7,6 +7,9 @@ settings:
|
||||
importers:
|
||||
.:
|
||||
devDependencies:
|
||||
7zip-min:
|
||||
specifier: ^2.1.0
|
||||
version: 2.1.0
|
||||
'@iconify/json':
|
||||
specifier: ^2.2.359
|
||||
version: 2.2.359
|
||||
@ -132,6 +135,18 @@ importers:
|
||||
version: 0.12.0
|
||||
|
||||
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':
|
||||
resolution:
|
||||
{
|
||||
@ -6114,6 +6129,12 @@ packages:
|
||||
engines: { node: '>= 10' }
|
||||
|
||||
snapshots:
|
||||
7zip-bin@5.1.1: {}
|
||||
|
||||
7zip-min@2.1.0:
|
||||
dependencies:
|
||||
7zip-bin: 5.1.1
|
||||
|
||||
'@alova/shared@1.3.1': {}
|
||||
|
||||
'@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();
|
||||
let reviews = await injector.getReviews();
|
||||
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.length > 0 && (await this.emit('review-collected', { OSMID, reviews }));
|
||||
goOn = await injector.tryJumpToNextPage();
|
||||
}
|
||||
setTimeout(() => {
|
||||
browser.tabs.remove(tab.id!);
|
||||
|
||||
@ -178,18 +178,29 @@ export class HomedepotDetailPageInjector extends BaseInjector {
|
||||
|
||||
public tryJumpToNextPage() {
|
||||
return this.run(async () => {
|
||||
while (!document.querySelector<HTMLElement>('.pager__summary')) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
}
|
||||
const final = document.querySelector<HTMLElement>(
|
||||
'.pager__summary--bold:nth-last-of-type(2)',
|
||||
'.pager__summary > span:nth-child(2)',
|
||||
)!.innerText;
|
||||
const anchor = document.querySelector<HTMLElement>(
|
||||
'.pager__summary--bold + .pager__summary--bold',
|
||||
'.pager__summary > span:nth-child(3)',
|
||||
)!.innerText;
|
||||
if (final === anchor) {
|
||||
return false;
|
||||
}
|
||||
const button = document.querySelector<HTMLElement>('[data-testid="pagination-Next"]');
|
||||
button!.click();
|
||||
let button = document.querySelector<HTMLElement>(
|
||||
'[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) {
|
||||
const newAnchor = document.querySelector<HTMLElement>(
|
||||
'.pager__summary--bold + .pager__summary--bold',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user