3jackdaws / soundcloud-lib

Soundcloud API wrapper for tracks & playlists that doesn't require API credentials. Asyncio support.
MIT License
94 stars 24 forks source link

'NoneType' object has no attribute 'timeout' #5

Closed Axel-Erfurt closed 4 years ago

Axel-Erfurt commented 5 years ago

In Mint 19.2 I get this Error Message Version: 0.4.2

Traceback (most recent call last): File "/home/brian/Dokumente/python_files/soundcloud_get.py", line 7, in track = api.resolve('https://soundcloud.com/wedontmindchaos/find-me-by-your-side-remake') File "/home/brian/.local/lib/python3.6/site-packages/sclib/sync.py", line 50, in resolve self.get_credentials() File "/home/brian/.local/lib/python3.6/site-packages/sclib/sync.py", line 45, in get_credentials script_text = get_page(script_url) File "/home/brian/.local/lib/python3.6/site-packages/sclib/sync.py", line 12, in get_page return get_url(url).decode('utf-8') File "/home/brian/.local/lib/python3.6/site-packages/sclib/sync.py", line 9, in get_url return urlopen(url).read() File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.6/urllib/request.py", line 517, in open req.timeout = timeout AttributeError: 'NoneType' object has no attribute 'timeout'

murilobsd commented 4 years ago

I tried to run the readme example and it gave the same problem, because when the util.find_script_url function tries to extract the url from the html tag <script src ...> it doesn't find any match case with the condition if 'app' ..

Probably change the content of the site. If they help, these are the values found by the above method:

<script crossorigin = "" src = "https://a-v2.sndcdn.com/assets/15-fd938769-3.js"> </script>
<script crossorigin = "" src = "https://a-v2.sndcdn.com/assets/51-dcb8eaa1-3.js"> </script>
<script crossorigin = "" src = "https://a-v2.sndcdn.com/assets/0-d3b4e139-3.js"> </script>
<script crossorigin = "" src = "https://a-v2.sndcdn.com/assets/1-ab1b69e0-3.js"> </script>
<script crossorigin = "" src = "https://a-v2.sndcdn.com/assets/2-4749e47b-3.js"> </script>
<script crossorigin = "" src = "https://a-v2.sndcdn.com/assets/50-83ad9030-3.js"> </script>
<script crossorigin = "" src = "https://a-v2.sndcdn.com/assets/49-2614f266-3.js"> </script>
3jackdaws commented 4 years ago

I've fixed this in version 0.5.0. @murilobsd, @Axel-Erfurt, thanks for your bug reports.