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

ValueError: unknown url type #1

Open
irishj opened this issue May 25, 2018 · 8 comments
Open

ValueError: unknown url type #1

irishj opened this issue May 25, 2018 · 8 comments

Comments

@irishj
Copy link

irishj commented May 25, 2018

Hi,

First of all, great utility, really like it.

Having a small issue whilst running the script, it throws the error below. Everything appears to download ok and install, just something to look at perhaps ? Not sure why it's thrown. Thanks !

Start downloading...
Download OculusSetup.exe
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "OculusDownload.py", line 85, in DownloadFileThread
fp = urlopen(AddAccessToken(uri))
File "C:\Python27\lib\urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 421, in open
protocol = req.get_type()
File "C:\Python27\lib\urllib2.py", line 283, in get_type
raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: ?access_token=OC|1582076955407037|

@ivellioscolin
Copy link
Owner

Have you tried python3? I think I should limit to python 3 only.

@ghost
Copy link

ghost commented May 28, 2018

Having the same issue with python3, but with Memory Error later on. (ram is around 4gb all of it is used when running)
This app is really useful, shame its overlooked.
Edit: hmm seems that I already have 2gb of data, seems to work on linux aswell (on a vps so I can create torrent for sharing - which handles bad internet)
Edit2: creating 8gb swap fixed it, reached 7gb almost after failing twice but download is complete

@ivellioscolin
Copy link
Owner

Let me check it later.

@Nico3D1982
Copy link

Hi !
Thanks for this usefull script.

I'm having quiet the same error with Python 3.6.5.
My download is not complete.

Thanks for your kind help.

Start downloading...
Download OculusSetup.exe
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "OculusDownload.py", line 85, in DownloadFileThread
fp = urlopen(AddAccessToken(uri))
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 511, in open
req = Request(fullurl, data)
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 329, in init
self.full_url = url
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 355, in full_url
self._parse()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 384, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: '?access_token=OC|1582076955407037|'

Download oculus-librarian.zip
Download oculus-runtime.zip
Download oculus-drivers.zip
Download oculus-compat.zip
Download oculus-client.zip
Download oculus-redistributable-installer.zip
Download oculus-home.zip
Download oculus-diagnostics.zip
Download oculus-overlays.zip
Download oculus-dreamdeck-nux.zip
Download oculus-touch-tutorial.zip
Download oculus-avatar-editor.zip
Download oculus-dash.zip
Download oculus-platform-runtime.zip
Download visual-cpp-2013.exe
Download visual-cpp-2013-x86.exe
Download directx-june-2010-.exe
Download visual-cpp-2015-update-3.exe
Download vulkan-runtime-1-0-65-1.exe
Download teaser.wmv
Download oculus-worlds.zip
Exception in thread Thread-12:
Traceback (most recent call last):
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "OculusDownload.py", line 86, in DownloadFileThread
fd = fp.read()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 462, in read
s = self._safe_read(self.length)
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 617, in _safe_read
return b"".join(s)
MemoryError

Exception in thread Thread-7:
Traceback (most recent call last):
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "OculusDownload.py", line 86, in DownloadFileThread
fd = fp.read()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 462, in read
s = self._safe_read(self.length)
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 617, in _safe_read
return b"".join(s)
MemoryError

Exception in thread Thread-11:
Traceback (most recent call last):
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "OculusDownload.py", line 86, in DownloadFileThread
fd = fp.read()
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 462, in read
s = self._safe_read(self.length)
File "C:\Users\Utilisateur\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 617, in _safe_read
return b"".join(s)
MemoryError

@ivellioscolin
Copy link
Owner

Unfortunately I'm currently busy on other project so don't have bandwidth to look into it. Basically from the error message, it looks like python3 has updated some package usage.
Here are some suggestions:

  1. Check py3 package urllib, see if any new updates.
  2. De-compile the original OculusSetup.exe, see if the user agent, access token or something else changed when request the download information from the server.

@Nico3D1982
Copy link

I'm not very familiar with decompiler (nor compiler ;-). Tried ''Reko Decompiler'' and can't find any clue.
Do you have a prefered software to do that effectively ?

@ivellioscolin
Copy link
Owner

You may try ildasm (included in Windows SDK) or .Net Reflector, download url, user agent and access token are stored in plain text.

@jezzab
Copy link

jezzab commented Jul 1, 2019

They changed their webpage so the setup exe fails to download and throws the above error. But everything else will download fine. This fixes it (im too lazy to do a PR). The token isnt required for the setup exe but it doesnt hurt anything.

ocDownloadUrl = 'https://www3.oculus.com/en-us/setup/'
ocHomeUrl = 'https://www.oculus.com'
ocInstallerConfigUrl = 'https://graph.oculus.com/bootstrap_installer_config'
ocSetupName = 'OculusSetup.exe'
ocDownloadCachePath = 'c:\\OculusSetup-DownloadCache'
ocAccessToken = 'access_token=OC|1582076955407037|'
ocUserAgent = 'Oculus/Dawn {"1.10.0.310422"}'
chromeUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'

class SetupLinkParser(HTMLParser):
    def __init__(self):
        self.url = ''
        HTMLParser.__init__(self)
    def handle_starttag(self, tag, attrs):
        if tag == 'a':
            ocSetupFound = 0
            for name,value in attrs:
                if name == 'class' and value == '_3hmq _4pg_ _4phe setup-pg-module__download-cta':
                    ocSetupFound = 1
                    break
            if ocSetupFound == 1:
                for name,value in attrs:
                    if name == 'href':
                        self.url = ocHomeUrl+value
                        break
    def getUrl(self):
        return self.url

def AddAccessToken(url):
    urlWToken = url
    if(url.find('?') == -1):
        urlWToken = url+'?'+ocAccessToken
    else:
        urlWToken = url+'&&'+ocAccessToken
    print(urlWToken)
    return urlWToken

def RequestInstaller():
    req = Request(ocDownloadUrl)
    req.add_header('User-agent', chromeUserAgent)
    reqRes = urlopen(req)
    return reqRes.read().strip().decode('utf-8')

Output:

C:\ocr_downloader>python OculusDownload.py d
********************
Start downloading...
https://graph.oculus.com/bootstrap_installer_config?access_token=OC|1582076955407037|
Download OculusSetup.exe
https://www.oculus.com/download_app/?id=1582076955407037&&access_token=OC|1582076955407037|
Download oculus-librarian.zip
.......

sschamp added a commit to sschamp/ocr_downloader that referenced this issue Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants