更新
This commit is contained in:
19
public/rules_2.json
Normal file
19
public/rules_2.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"priority": 1,
|
||||||
|
"action": {
|
||||||
|
"type": "modifyHeaders",
|
||||||
|
"requestHeaders": [
|
||||||
|
{
|
||||||
|
"header": "Origin",
|
||||||
|
"operation": "set",
|
||||||
|
"value": "https://www.temu.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"condition": {
|
||||||
|
"urlFilter": "||www.temu.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -35,6 +35,10 @@
|
|||||||
"id": "1",
|
"id": "1",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"path": "rules_1.json"
|
"path": "rules_1.json"
|
||||||
|
},{
|
||||||
|
"id": "2",
|
||||||
|
"enabled": true,
|
||||||
|
"path": "rules_2.json"
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
"id": "1",
|
"id": "1",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"path": "rules_1.json"
|
"path": "rules_1.json"
|
||||||
|
},{
|
||||||
|
"id": "2",
|
||||||
|
"enabled": true,
|
||||||
|
"path": "rules_2.json"
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
|
|||||||
@@ -73,7 +73,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {sendTemuAPIMessage} from '@/api/chromeApi'
|
import {sendChromeWebReqMessage} from '@/api/chromeApi'
|
||||||
|
import { Message } from 'element-ui'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'List',
|
name: 'List',
|
||||||
@@ -201,55 +202,53 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
|
|||||||
this.beginCollect(row)
|
this.beginCollect(row)
|
||||||
},
|
},
|
||||||
beginCollect(row) {
|
beginCollect(row) {
|
||||||
sendTemuAPIMessage({
|
sendChromeWebReqMessage({
|
||||||
url: 'api/poppy/v1/search?scene=search',
|
type: 'temu',
|
||||||
anti: true,
|
url: 'https://www.temu.com/search_result.html?search_key='+row.content+'&search_method=user&filter_items='+row.orderType
|
||||||
data:
|
}).then((res) => {
|
||||||
{
|
this.isLoading = false
|
||||||
"scene": "search",
|
if (res.indexOf("rawData") == -1) {
|
||||||
"offset": (this.pageNo-1) * this.pageSize,
|
Message.error("请检查地址是否正确,或者“TEMU”网站是否出现图形验证码")
|
||||||
"pageSize": 120,
|
return
|
||||||
"query": row.content,
|
}
|
||||||
"filterItems": row.orderType,
|
let str = res.substring(res.indexOf("rawData"))
|
||||||
"searchMethod": "suggest"
|
str = str.substring(0, str.indexOf("<\/script>"))
|
||||||
}}).then((res) => {
|
str = str.substring(str.indexOf("{"))
|
||||||
this.isLoading = false
|
str = str.substring(0, str.lastIndexOf("}"))
|
||||||
if (res.success) {
|
str = str + "}"
|
||||||
res.result.data.goods_list.map(item => {
|
let obj = JSON.parse(str)
|
||||||
let total = 0
|
let goodsList = obj.store.goodsList
|
||||||
if (item.sales_tip_text[0]) {
|
goodsList.map(t => {
|
||||||
total = item.sales_tip_text[0]
|
let item = t.data
|
||||||
total = total.replace('+', '')
|
let total = 0
|
||||||
if (total.indexOf('K') != -1) {
|
if (item.salesNum) {
|
||||||
total = total.replace('K', '')
|
total = item.salesNum
|
||||||
total = total * 1000
|
total = total.replace('+', '')
|
||||||
} else if (total.indexOf('M') != -1) {
|
if (total.indexOf('K') != -1) {
|
||||||
total = total.replace('M', '')
|
total = total.replace('K', '')
|
||||||
total = total * 1000000
|
total = total * 1000
|
||||||
}
|
} else if (total.indexOf('M') != -1) {
|
||||||
}
|
total = total.replace('M', '')
|
||||||
this.detailsVo.details.push({
|
total = total * 1000000
|
||||||
url: item.link_url,
|
}
|
||||||
price: item.price_info.price_schema,
|
}
|
||||||
saleTotal: total,
|
this.detailsVo.details.push({
|
||||||
goodsId: item.goods_id,
|
url: item.linkUrl,
|
||||||
imgUrl: item.thumb_url,
|
price: item.priceInfo.priceSchema,
|
||||||
mallId: item.mall_id
|
saleTotal: total,
|
||||||
})
|
goodsId: item.goodsId,
|
||||||
})
|
imgUrl: item.thumbUrl,
|
||||||
console.log(this.detailsVo)
|
mallId: item.mallId
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
this.$http.post('/api/monitorDetail/addDetails',this.detailsVo
|
this.$http.post('/api/monitorDetail/addDetails',this.detailsVo).then(res => {
|
||||||
).then(res => {
|
if (res.code == 0) {
|
||||||
if (res.code == 0) {
|
this.$message.success('关键字【' + row.content + '】数据采集成功!')
|
||||||
this.$message.success('关键字【' + row.content + '】数据采集成功!')
|
this.getList()
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$message.error("采集失败,请检查网络情况")
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user