Skip to content

Commit

Permalink
feat: 优化访问详情页 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
meooxx authored Mar 24, 2022
1 parent 29282cf commit 64aa215
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ async function submitOrderFromShoppingCart(
let times = 0;
//现在只支持一个
const skuId = skuIds[0];
console.log('获取库存信息参数:', skuId, params[skuId]);
while (times <= maxPollingTimes) {
times++;
try {
Expand Down Expand Up @@ -470,7 +471,13 @@ async function getSkusData(areaId) {
*/
async function getPageConfig(skuId, area) {
// 访问详情页 item.xxx.com/skuId.html
const page = await getPage();
const filter = request => {
const sourceType = request.resourceType();
const isDocument = sourceType === 'document';
return isDocument;
};

const page = await getPage(filter);
const url = `https://item.jd.com/${skuId}.html`;
const cookies = await helper.reqTools.getCookies(url);
await page.setCookie(
Expand Down

0 comments on commit 64aa215

Please sign in to comment.