Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mylamour opened this issue Apr 14, 2023 · 0 comments
Open
Labels
学习 learning 总结 summary 教程 tutorial 笔记 note

Comments

@mylamour
Copy link
Owner

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)
@mylamour mylamour added 教程 tutorial 总结 summary 学习 learning 笔记 note labels Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
学习 learning 总结 summary 教程 tutorial 笔记 note
Projects
None yet
Development

No branches or pull requests

1 participant