mirror of
https://github.com/primedigitaltech/azon_seeker.git
synced 2026-01-19 13:13:22 +08:00
Update
This commit is contained in:
parent
2bafb403ea
commit
0059f8246b
24
README.md
24
README.md
@ -18,25 +18,34 @@ Azon Seeker is a browser extension designed to collect and manage product inform
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Setup
|
## Get Started
|
||||||
|
|
||||||
### 1. Prepare Requirements
|
### 1. Prepare Requirements
|
||||||
|
|
||||||
Make sure the following software is installed:
|
Make sure the following software is installed:
|
||||||
|
|
||||||
- [Node.js](https://nodejs.org/)
|
- [Node.js v22+](https://nodejs.org/)
|
||||||
- [pnpm](https://pnpm.io/)
|
- [pnpm](https://pnpm.io/)
|
||||||
|
|
||||||
### 2. Clone this Repo
|
### 2. Clone this Repository
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/primedigitaltech/azon_seeker.git
|
git clone https://github.com/primedigitaltech/azon_seeker.git
|
||||||
|
cd ./azon_seeker/
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Install the Node Dependencies
|
### 3. Setup the Webext-bridge
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd ./webext-bridge
|
||||||
|
pnpm i
|
||||||
|
pnpm build
|
||||||
|
cd ../
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Install the Project's Dependencies
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cd azon_seeker
|
|
||||||
pnpm i
|
pnpm i
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -56,12 +65,13 @@ pnpm dev
|
|||||||
|
|
||||||
### 1. Make Sure Setup Successfully
|
### 1. Make Sure Setup Successfully
|
||||||
|
|
||||||
Following the step of setup
|
Following the step of Get Started to make sure setup successfully.
|
||||||
|
|
||||||
### 2. Build Project
|
### 2. Build Project
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pnpm run build
|
pnpm run build # For Chromium Browser (Microsoft Edge .etc)
|
||||||
|
pnpm run build-firefox # For Firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Pack Extension
|
### 3. Pack Extension
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@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/node": "^22.16.4",
|
"@types/node": "^22.16.4",
|
||||||
"@types/webextension-polyfill": "^0.12.3",
|
"@types/webextension-polyfill": "^0.12.3",
|
||||||
"@vitejs/plugin-vue": "^6.0.0",
|
"@vitejs/plugin-vue": "^6.0.0",
|
||||||
|
|||||||
37
pnpm-lock.yaml
generated
37
pnpm-lock.yaml
generated
@ -13,6 +13,9 @@ importers:
|
|||||||
'@types/fs-extra':
|
'@types/fs-extra':
|
||||||
specifier: ^11.0.4
|
specifier: ^11.0.4
|
||||||
version: 11.0.4
|
version: 11.0.4
|
||||||
|
'@types/gulp-terser':
|
||||||
|
specifier: ^1.2.6
|
||||||
|
version: 1.2.6
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.16.4
|
specifier: ^22.16.4
|
||||||
version: 22.16.4
|
version: 22.16.4
|
||||||
@ -1098,6 +1101,12 @@ packages:
|
|||||||
integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==,
|
integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
'@types/gulp-terser@1.2.6':
|
||||||
|
resolution:
|
||||||
|
{
|
||||||
|
integrity: sha512-/4wRi8Edn1ykh1GJdfSN2VvPLWqPP7Y6sG1n5CnRgMCDCfjZ2rLu04vNJK7gAsg+0E5IoDVIpya/mO9es2LsJw==,
|
||||||
|
}
|
||||||
|
|
||||||
'@types/jsonfile@6.1.4':
|
'@types/jsonfile@6.1.4':
|
||||||
resolution:
|
resolution:
|
||||||
{
|
{
|
||||||
@ -1892,6 +1901,12 @@ packages:
|
|||||||
}
|
}
|
||||||
engines: { node: '>=20' }
|
engines: { node: '>=20' }
|
||||||
|
|
||||||
|
commander@2.20.3:
|
||||||
|
resolution:
|
||||||
|
{
|
||||||
|
integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==,
|
||||||
|
}
|
||||||
|
|
||||||
commander@2.9.0:
|
commander@2.9.0:
|
||||||
resolution:
|
resolution:
|
||||||
{
|
{
|
||||||
@ -5350,6 +5365,14 @@ packages:
|
|||||||
}
|
}
|
||||||
engines: { node: '>=6' }
|
engines: { node: '>=6' }
|
||||||
|
|
||||||
|
terser@4.8.1:
|
||||||
|
resolution:
|
||||||
|
{
|
||||||
|
integrity: sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw==,
|
||||||
|
}
|
||||||
|
engines: { node: '>=6.0.0' }
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
text-table@0.2.0:
|
text-table@0.2.0:
|
||||||
resolution:
|
resolution:
|
||||||
{
|
{
|
||||||
@ -6628,6 +6651,11 @@ snapshots:
|
|||||||
'@types/jsonfile': 6.1.4
|
'@types/jsonfile': 6.1.4
|
||||||
'@types/node': 22.16.4
|
'@types/node': 22.16.4
|
||||||
|
|
||||||
|
'@types/gulp-terser@1.2.6':
|
||||||
|
dependencies:
|
||||||
|
'@types/node': 22.16.4
|
||||||
|
terser: 4.8.1
|
||||||
|
|
||||||
'@types/jsonfile@6.1.4':
|
'@types/jsonfile@6.1.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.16.4
|
'@types/node': 22.16.4
|
||||||
@ -7173,6 +7201,8 @@ snapshots:
|
|||||||
|
|
||||||
commander@14.0.0: {}
|
commander@14.0.0: {}
|
||||||
|
|
||||||
|
commander@2.20.3: {}
|
||||||
|
|
||||||
commander@2.9.0:
|
commander@2.9.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
graceful-readlink: 1.0.1
|
graceful-readlink: 1.0.1
|
||||||
@ -9241,6 +9271,13 @@ snapshots:
|
|||||||
inherits: 2.0.4
|
inherits: 2.0.4
|
||||||
readable-stream: 3.6.2
|
readable-stream: 3.6.2
|
||||||
|
|
||||||
|
terser@4.8.1:
|
||||||
|
dependencies:
|
||||||
|
acorn: 8.15.0
|
||||||
|
commander: 2.20.3
|
||||||
|
source-map: 0.6.1
|
||||||
|
source-map-support: 0.5.21
|
||||||
|
|
||||||
text-table@0.2.0: {}
|
text-table@0.2.0: {}
|
||||||
|
|
||||||
thread-stream@2.7.0:
|
thread-stream@2.7.0:
|
||||||
|
|||||||
@ -110,7 +110,7 @@ class AmazonPageWorkerImpl
|
|||||||
options: Parameters<typeof this.runDetailPageTask>[1] = {},
|
options: Parameters<typeof this.runDetailPageTask>[1] = {},
|
||||||
) {
|
) {
|
||||||
//#region Initial Meta Info
|
//#region Initial Meta Info
|
||||||
const { aplus = false, extra = false } = options;
|
const { image = false, aplus = false, extra = false } = options;
|
||||||
const params = { asin: '', url: '' };
|
const params = { asin: '', url: '' };
|
||||||
if (entry.match(/^https?:\/\/www\.amazon\.com.*\/dp\/[A-Z0-9]{10}/)) {
|
if (entry.match(/^https?:\/\/www\.amazon\.com.*\/dp\/[A-Z0-9]{10}/)) {
|
||||||
const [asin] = /\/\/dp\/[A-Z0-9]{10}/.exec(entry)!;
|
const [asin] = /\/\/dp\/[A-Z0-9]{10}/.exec(entry)!;
|
||||||
@ -172,13 +172,15 @@ class AmazonPageWorkerImpl
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
//#region Fetch Goods' Images
|
//#region Fetch Goods' Images
|
||||||
const imageUrls = await injector.getImageUrls();
|
if (image) {
|
||||||
imageUrls.length > 0 &&
|
const imageUrls = await injector.getImageUrls();
|
||||||
(await this.emit('item-images-collected', {
|
imageUrls.length > 0 &&
|
||||||
asin: params.asin,
|
(await this.emit('item-images-collected', {
|
||||||
imageUrls: Array.from(new Set(imageUrls)),
|
asin: params.asin,
|
||||||
}));
|
imageUrls: Array.from(new Set(imageUrls)),
|
||||||
await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait 2 seconds.
|
}));
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait 2 seconds.
|
||||||
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
//#region Fetch Top Reviews
|
//#region Fetch Top Reviews
|
||||||
// const reviews = await injector.getTopReviews();
|
// const reviews = await injector.getTopReviews();
|
||||||
@ -190,8 +192,9 @@ class AmazonPageWorkerImpl
|
|||||||
//#endregion
|
//#endregion
|
||||||
// #region Get APlus Sreen shot
|
// #region Get APlus Sreen shot
|
||||||
if (aplus && (await injector.scanAPlus())) {
|
if (aplus && (await injector.scanAPlus())) {
|
||||||
const { b64: base64data } = await injector.captureAPlus();
|
const { b64: base64data } = (await injector.captureAPlus()) || {};
|
||||||
await this.emit('item-aplus-screenshot-collect', { asin: params.asin, base64data });
|
typeof base64data === 'string' &&
|
||||||
|
(await this.emit('item-aplus-screenshot-collect', { asin: params.asin, base64data }));
|
||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
//#region Get Extra Info
|
//#region Get Extra Info
|
||||||
@ -249,7 +252,7 @@ class AmazonPageWorkerImpl
|
|||||||
|
|
||||||
public async runDetailPageTask(
|
public async runDetailPageTask(
|
||||||
asins: string[],
|
asins: string[],
|
||||||
options: taskOptionBase & { aplus?: boolean; extra?: boolean } = {},
|
options: taskOptionBase & { image?: boolean; aplus?: boolean; extra?: boolean } = {},
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { progress } = options;
|
const { progress } = options;
|
||||||
const remains = [...asins];
|
const remains = [...asins];
|
||||||
|
|||||||
@ -28,12 +28,14 @@ export class BaseInjector {
|
|||||||
|
|
||||||
protected async screenshot(
|
protected async screenshot(
|
||||||
data: ProtocolMap['dom-to-image']['data'],
|
data: ProtocolMap['dom-to-image']['data'],
|
||||||
): Promise<ProtocolMap['dom-to-image']['return']> {
|
): Promise<ProtocolMap['dom-to-image']['return'] | null> {
|
||||||
const sender = await this.getMessageSender();
|
const sender = await this.getMessageSender();
|
||||||
return sender!.sendMessage('dom-to-image', data, {
|
return sender!
|
||||||
context: 'content-script',
|
.sendMessage('dom-to-image', data, {
|
||||||
tabId: this._tab.id!,
|
context: 'content-script',
|
||||||
});
|
tabId: this._tab.id!,
|
||||||
|
})
|
||||||
|
.catch((_) => null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected run<T, P extends Record<string, unknown>>(
|
protected run<T, P extends Record<string, unknown>>(
|
||||||
|
|||||||
@ -87,8 +87,7 @@ const launch = async () => {
|
|||||||
progress: (remains) => {
|
progress: (remains) => {
|
||||||
detailAsinInput.value = remains.join('\n');
|
detailAsinInput.value = remains.join('\n');
|
||||||
},
|
},
|
||||||
aplus: detailWorkerSettings.value.aplus,
|
...detailWorkerSettings.value,
|
||||||
extra: detailWorkerSettings.value.extra,
|
|
||||||
});
|
});
|
||||||
timelines.value.push({
|
timelines.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
@ -129,6 +128,9 @@ const handleInterrupt = () => {
|
|||||||
label-align="center"
|
label-align="center"
|
||||||
:show-feedback="false"
|
:show-feedback="false"
|
||||||
>
|
>
|
||||||
|
<n-form-item label="Image:">
|
||||||
|
<n-switch v-model:value="detailWorkerSettings.image" />
|
||||||
|
</n-form-item>
|
||||||
<n-form-item label="Aplus:">
|
<n-form-item label="Aplus:">
|
||||||
<n-switch v-model:value="detailWorkerSettings.aplus" />
|
<n-switch v-model:value="detailWorkerSettings.aplus" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|||||||
@ -11,6 +11,7 @@ export const itemColumnSettings = useWebExtensionStorage<
|
|||||||
>('itemColumnSettings', new Set(['keywords', 'page', 'rank', 'createTime']));
|
>('itemColumnSettings', new Set(['keywords', 'page', 'rank', 'createTime']));
|
||||||
|
|
||||||
export const detailWorkerSettings = useWebExtensionStorage('amazon-detail-worker-settings', {
|
export const detailWorkerSettings = useWebExtensionStorage('amazon-detail-worker-settings', {
|
||||||
|
image: true,
|
||||||
aplus: false,
|
aplus: false,
|
||||||
extra: false,
|
extra: false,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user