pinscrape Python Library

repository·main·Indexed 41 days ago

https://github.com/iamatulsingh/pinscrape

A Python package for scraping images from Pinterest using search keywords and retrieving metadata for specific Pinterest boards via the Pinterest class.

Tokens
525
Snippets
3
Records
3
Agent score
50%

What's inside pinscrape

  1. Scrape Pinterest images using the Pinterest API class

    main

    The recommended way to use pinscrape is via the Pinterest class. This approach allows you to search for keywords, download images using multiple workers, and retrieve specific board details.

    Note: The scraper.scrape method is deprecated. Use the Pinterest class instead.

    from pinscrape import scraper, Pinterest
    
    keyword = "messi"
    output_folder = "output"
    proxies = {}
    number_of_workers = 10
    images_to_download = 1
    
    # Recommended usage
    p = Pinterest(proxies=proxies, sleep_time=2) # you can also pass `user_agent` here.
    images_url = p.search(keyword, images_to_download)
    p.download(url_list=images_url, number_of_workers=number_of_workers, output_folder=output_folder)
  2. Retrieve Pinterest board details

    main

    You can use the get_pin_details method from a Pinterest instance to fetch metadata about a specific user's board. This returns a dictionary containing resource information, such as the creation timestamp.

    from pinscrape import Pinterest
    
    p = Pinterest(proxies={}, sleep_time=2)
    board_details = p.get_pin_details(username='canva', board='design-trends')
    
    # Accessing data from the response
    print(board_details)
    print(board_details.get('resource_response', {}).get('data', {}).get('created_at'))