Get all images from a board from a Pinterest web address

后端 未结 5 1269
遥遥无期
遥遥无期 2021-02-09 05:50

This question sounds easy, but it is not as simple as it sounds.

Brief summary of what\'s wrong

For an example, use this board; http://pinterest

5条回答
  •  情书的邮戳
    2021-02-09 06:29

    Probably a bit late but, with py3-pinterest open source project you can do it easily:

    First get all pins as objects from the board, they include the original image url also.

    # get all pins for the board
    board_pins = []
    pin_batch = pinterest.board_feed(board_id=target_board['id'], board_url=target_board['url'])
    
    while len(pin_batch) > 0:
        board_pins += pin_batch
        pin_batch = pinterest.board_feed(board_id=target_board['id'], board_url=target_board['url'])
    

    Then you can obtain the image urls and download them or do whatever you like with them

    for pin in board_pins:
        url = pin['image']
        # process image url..
    

    Full code example: https://github.com/bstoilov/py3-pinterest/blob/master/download_board_images.py

    Yes its python but if you still insist on c# it should be easy to port it :)

提交回复
热议问题