sudheer-ranga / aliexpress-product-scraper

Get Aliexpress product details as a json response including feedbacks, variants, shipping info, description, images, etc.,
MIT License
231 stars 88 forks source link

scrape() should take object of options, not ordered parameters #5

Closed tobiasmuehl closed 9 months ago

tobiasmuehl commented 4 years ago

Seeing that there are more features added that need input parameters, I think we should refactor the scrape function as such:

type AliExpressScrapeOptions = {
  puppeteerOptions?: LaunchOptions,
  feedbackLimit?: Number,
  shippingCountryNames?: String[] // should be typed with the list of country codes so it's clear which standard is being used
}

function scrape(productId: number, options: AliExpressScrapeOptions = {})
sudheer-ranga commented 4 years ago

Yes @tobiasmuehl. This will be taken care of in the next release.

MrBaz commented 4 years ago

Hi, thanks for the great efforts. I have a question please, can you explain what is await page.evaluate(() => runParams); do and what is the runParams value ?

sudheer-ranga commented 4 years ago

Hi, thanks for the great efforts. Thank you for your kind words.

I have a question please, can you explain what is await page.evaluate(() => runParams); do and what is the runParams value ?

await page.goto(`https://www.aliexpress.com/item/${productId}.html`); const aliExpressData = await page.evaluate(() => runParams);

  1. Visits the given URL and wait till the page is loaded.
  2. Once the page is loaded, we will search for the variable runParams and return its value which is an object. We are using this object info to build JSON.
dilazure commented 3 years ago

Can you explain how it use?

sudheer-ranga commented 9 months ago

This is fixed in the new release v2.0.2. Closing the issue.