简体   繁体   中英

Download images from Github in python

I am creating a model of image processing using Google Colab. I have a few images uploaded in a repository, lets say it has the following URL: https://github.com/repo . Instead of having to upload the images manually one by one to Google Colab, I want to use the command wget in order to download them without exiting my notebook. My problem is that I have to download the raw images, because otherwise, I would download the web page that shows the image.

The raw images have the following URLs: https://raw.githubusercontent.com/repo/1.jpg?token=

The token varies from sessions and each image has a different token. Is there a way to download an image from a repo either not having to access the raw page or via any API?? (because I suppose the tokens are generated randomly so trying to guess them would not be right)

如果您的回购是公开的,您可以使用此链接:

https://github.com/{username}/{repository}/raw/{branch}/file.jpg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM