Androz2091 / vinted-api

JavaScript library to interact with the Vinted API
87 stars 34 forks source link

How to get the products link picture with this API ? #2

Closed jabibamman closed 2 years ago

jabibamman commented 2 years ago

Hello, I am looking to be able to retrieve the URL of the first photo of all the articles with this function:

     vinted.search('https://www.vinted.fr/clothes?brand_id[]=32').then((posts) => {
         // In the json result, there would be an extra row that would include the main photo link
         console.log (posts)
   });

Is it possible ?

jabibamman commented 2 years ago

For retrieve the main url pic, you need to do this :

        vinted.search('https://www.vinted.fr/vetements?brand_id[]=32').then((posts) => {
            posts.items.forEach(product => {
                console.log (product.photo.url)
            });
        });