google-images-download icon indicating copy to clipboard operation
google-images-download copied to clipboard

Cannot open url

Open pranavhari2 opened this issue 4 years ago • 9 comments

Screenshot 2020-05-05 at 9 52 52 PM

Can anyone help me with this?

pranavhari2 avatar May 06 '20 01:05 pranavhari2

It looks like the program cannot access internet... You may check for any proxy/vpn materials or anything else that could alter your connection.

unguest avatar May 08 '20 10:05 unguest

This is nothing but the problem of reaching the URL from the original browser. So just download a VPN and try again

Ajiteshrock avatar May 27 '20 15:05 Ajiteshrock

This issue is because of SSL certificate

Steps to solve :

In macOS go to Macintosh HD > Applications > Python3.6 folder (or whatever version of python you're using) > double click on "Install Certificates.command" file.

prkkhan786 avatar Jun 12 '20 14:06 prkkhan786

Same issue, I'm on Windows

meme8383 avatar Jun 15 '20 22:06 meme8383

Same issue. I'm also on Windows. Any fixes? It was fully functional two weeks ago. I didn't change anything in my environment

NickT5 avatar Aug 29 '20 14:08 NickT5

Same issue here, also on windows. Certifi is installed and I have google's cert inside.

maracko avatar Aug 30 '20 11:08 maracko

I have the same problem on Centos 6. It was all working fine a few weeks ago - now doesn't download images and always gives the error "Could not open URL. Please check your internet connection and/or ssl settings If you are using proxy, make sure your proxy settings is configured correctly" I have tried various python fixes to avoid the ssl certificate, but no luck.

greg-oz avatar Aug 31 '20 05:08 greg-oz

`
def _find_last(self,string,str): last_position=-1 while True: position=string.find(str,last_position+1) if position==-1: return last_position last_position=position

# Downloading entire Web Document (Raw Page Content)
def download_page(self, url):
    version = (3, 0)
    cur_version = sys.version_info
    if cur_version >= version:  # If the Current Version of Python is 3.0 or above
        try:
            proxy_support = urllib.request.ProxyHandler({'https':'127.0.0.1:51593'})
            opener = urllib.request.build_opener(proxy_support)
            urllib.request.install_opener(opener)
            headers = {}
            headers[
                'User-Agent'] = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.17 Safari/537.36"
            req = urllib.request.Request(url, headers=headers)
            resp = urllib.request.urlopen(req)
            respData = str(resp.read())
            respDatas = self._extract_data_pack(respData)
            respDatas = respDatas[:self._find_last(respDatas,",")]
            return self._image_objects_from_pack(respDatas), self.get_all_tabs(respData)
        except Exception as e:
            print("Could not open URL. Please check your internet connection and/or ssl settings \n"
                  "If you are using proxy, make sure your proxy settings is configured correctly")
            sys.exit()
    else:  # If the Current Version of Python is 2.x
        try:
            headers = {}
            headers[
                'User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
            req = urllib2.Request(url, headers=headers)
            try:
                response = urllib2.urlopen(req)
            except URLError:  # Handling SSL certificate failed
                context = ssl._create_unverified_context()
                response = urlopen(req, context=context)
            page = response.read()
            return self._image_objects_from_pack(self._extract_data_pack(page)), self.get_all_tabs(page)
        except:
            print("Could not open URL. Please check your internet connection and/or ssl settings \n"
                  "If you are using proxy, make sure your proxy settings is configured correctly")
            sys.exit()
            return "Page Not found"`

Here's my solution

tzq865 avatar Sep 02 '20 10:09 tzq865

@tzq865 Thank your solutions , but it not work.

Rerchaos avatar Sep 11 '20 07:09 Rerchaos