Skip to content

How to download image from github (user-images.githubusercontent.com) #97

@mylamour

Description

@mylamour

In fact, it's rellay idiot. but i totally understand that. because you can't always download the file. otherwise, the server will block you. so after few years use github to host my image, it almost 300+ images here. and since i found some area was blocked this domain hence my blog was display fully. so i try to build a new solution, and most detilas you can find here #96 .

i tried lot, use pyGithub package, use bear token and so on

so here is the tricks( you may think is fool ,but it works.):

add ?token=xxxxxxxx in the url

here is example:

for url in $(cat new)
do
  curl --user-agent "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" -L -H "Accept: application/vnd.github.full+json" $url?token=xxxxxxxxxxx -O
done

Finally, i download all files and upload it to s3 :

Screenshot 2023-04-14 at 16 50 43

and can access it with my domain, here is example https://img.iami.xyz/images/197389197-94db2c9f-6c70-4c0a-8e8d-ccc348a2d331.gif

img

Tips

  • how to find two files different : comm -13 <(sort url) <(sort url2) > new ( i use this commond to find those different urls)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions