Skip to content

Giglium/vinted_scraper

Vinted Scraper

Package Version Python Version codecov Codacy Badge License FOSSA Status

A very simple Python package for scraping Vinted. Supports both synchronous and asynchronous operations with automatic cookie management and typed responses.

📖 Full Documentation | 💡 Examples | 📝 Changelog

Installation

Install using pip:

pip install vinted_scraper

Functions

The package offers the following methods:

search - Gets all items from the listing page based on search parameters.

Parameters

name type data type description
params optional Dict Query parameters like the pagination and so on

Returns: List[VintedItem] (VintedScraper) or Dict[str, Any] (VintedWrapper)

item - Gets detailed information about a specific item and its seller.

It returns a 403 error after a few uses. See #58).

Parameters

name type data type description
id required str The unique identifier of the item to retrieve
params optional Dict I don't know if they exist

Returns: VintedItem (VintedScraper) or Dict[str, Any] (VintedWrapper)

curl - Perform an HTTP GET request to the given endpoint.

Parameters

name type data type description
endpoint required str The endpoint to make the request to
params optional Dict Query parameters like the pagination and so on

Returns: VintedJsonModel (VintedScraper) or Dict[str, Any] (VintedWrapper)

Usage

from vinted_scraper import VintedScraper

scraper = VintedScraper("https://www.vinted.com")
items = scraper.search({"search_text": "board games"})

for item in items:
    print(f"{item.title} - {item.price}")

Check out the examples for more!

Debugging

To enable debug logging for troubleshooting:

import logging

# Configure logging BEFORE importing vinted_scraper
logging.basicConfig(
    level=logging.DEBUG,
    format="%(levelname)s:%(name)s:%(message)s"
)

from vinted_scraper import VintedScraper

scraper = VintedScraper("https://www.vinted.com")
scraper.search({"search_text": "board games"})
Debug output (click to expand)
DEBUG:vinted_scraper._vinted_wrapper:Initializing VintedScraper(baseurl=https://www.vinted.com, user_agent=None, session_cookie=auto-fetch, config=None)
DEBUG:vinted_scraper._vinted_wrapper:Refreshing session cookie
DEBUG:vinted_scraper._vinted_wrapper:Cookie fetch attempt 1/3
DEBUG:vinted_scraper._vinted_wrapper:Session cookie fetched successfully: eyJraWQiOiJFNTdZZHJ1...
DEBUG:vinted_scraper._vinted_wrapper:Calling search() with params: {'search_text': 'board games'}
DEBUG:vinted_scraper._vinted_wrapper:API Request: GET /api/v2/catalog/items with params {'search_text': 'board games'}
DEBUG:vinted_scraper._vinted_wrapper:API Response: /api/v2/catalog/items - Status: 200

Common Issues

  • 403 Forbidden Error: The item() method frequently return 403 errors (#58).

  • Cookie Fetch Failed: If cookies cannot be fetched:

    • Verify the base URL is correct
    • Check your internet connection, some VPN are banned. Try manually getting the cookie by running the following:
      curl -v -c - -L "<base-url>" | grep access_token_web

License

This project is licensed under the MIT License - see the LICENSE file for details.

FOSSA Status

About

A very simple Python package for scraping Vinted. Supports both synchronous and asynchronous operations with automatic cookie management and typed responses.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks