Tags:
Forums: 

ผมพยายามโหลดรูป http://upic.me/i/jz/tumblr_ln5t3kvrzz1qknzp5o1_500.jpg
โดยใช้ urllib ดูแต่โหลดแล้วภาพใช้ไม่ได้

Browse ตาม link เจอแต่รูปเปล่าๆ มีโค้ด html นิดหน่อย ซึ่งถ้าใช้ urllib.retrieve() แล้วภาพไม่ขึ้น

import urllib

urllib.urlretrieve('http://upic.me/i/jz/tumblr_ln5t3kvrzz1qknzp5o1_500.jpg','abe.jpg')

แล้วพัง รู่สึกว่าที่โหลดมามันไม่ใช่รูป แต่เป็น html แสดงว่ามันต้อง protect อะไรไว้แน่ๆ แต่ผมไม่มีความรู้เลยว่าทำไงดี มีใครแนะนำอะไรบ้างได้ไหมครับว่าปัญหาอยู่ที่ไหน โค้ดนี้โหลดรูปอื่นได้แต่โหลดจาก upic.me ไม่ได้

Get latest news from Blognone
By: lancaster
Contributor
on 3 April 2015 - 22:02 #804412

ใส่ referer ด้วยครับ

By: Jaddngow
AndroidUbuntuWindows
on 3 April 2015 - 22:12 #804415 Reply to:804412
Jaddngow's picture

ไม่ค่อยเข้าใจ referer
หมายถึงเว็บก่อนที่จะเข้าไปถึงภาพนั้นเหรอครับ
ผมก๊อบมาจากใน
http://upic.me/show/55131719 ครับ มันเป็นdirect link อยู่

By: icez
ContributoriPhoneAndroidRed Hat
on 3 April 2015 - 22:15 #804416

แก้ url ไฟล์รูปเปน https ครับ

By: Jaddngow
AndroidUbuntuWindows
on 3 April 2015 - 22:26 #804418 Reply to:804416
Jaddngow's picture

ใช้ได้จริงด้วย แต่ผมไม่เข้าใจหลักการเลยครับว่าทำไม htttps ถึงได้

ขอบคุณมากๆครับ

By: icez
ContributoriPhoneAndroidRed Hat
on 3 April 2015 - 23:40 #804425 Reply to:804418

server set ไว้แบบนั้นครับ

By: hisoft
ContributorWindows PhoneWindows
on 4 April 2015 - 00:15 #804429 Reply to:804418
hisoft's picture

สงสัยให้รีบถามครับ ไม่เชื่อกลับไปดูตรงคำว่า powered by ในเว็บนั้นอีกทีครับ ;)

By: Jaddngow
AndroidUbuntuWindows
on 4 April 2015 - 10:11 #804466 Reply to:804429
Jaddngow's picture

อ๊ะ!!!!!!
ขอบคุณมากครับ