示例#1
0
    def write_img(self, page_url, path, _time):

        # 先等待几秒,防反爬
        sleep(_time)

        try:
            # 使用Request添加头部的方法,读取图片链接再写入,最重要的是加上Referer
            Soup.write_img(page_url, path, referer=self.index_page_url)
        except BaseException as msg:
            print(msg)
示例#2
0
    def readPagetoTxt(self, page_url, path, _time):

        # 先等待几秒,防反爬
        sleep(_time)

        # 使用此方法,下载图片为盗链
        # urllib.request.urlretrieve(page_url, path)

        # 使用Request添加头部的方法,读取图片链接再写入,最重要的是加上Referer
        Soup.write_img(page_url, path, referer=self.index_page_url)
        '''