The picture can be downloaded, but the climbing link is not this picture.

try to climb a website where the picture can be downloaded by right-click, but the link inside is not the picture.
site link: http://www.plantphoto.cn/tu/2..
ask the master, is there any technology in the background to hide the real picture link? How to get a real link. Thank you!

Mar.17,2021

The

website has taken hotlink protection measures. When making a request, just add referer to the request header.
demo code is as follows:

-sharp! /usr/bin/env python
-sharp -*- coding: utf-8 -*-
""" 
@author:hp 
@file: 6.5.py 
@time: 2018/6/5
"""
import requests,os

def download_picture():

    url = 'http://img.plantphoto.cn/image2/b/2391908.jpg'
    header = {'Referer': 'http://www.plantphoto.cn/tu/2391908'}
    res = requests.get(url,headers=header,stream=True)
    with open(os.getcwd() + os.sep + '2391908.jpg',mode= 'wb') as f:
            f.write(res.content)

if __name__ == '__main__':
    download_picture()

Menu