Cache preview URLs early
Totally not modifying the API to conform with the project based on it
This commit is contained in:
parent
a70f181673
commit
042f732c69
@ -339,6 +339,14 @@ class User:
|
||||
# Get all the submissions on this page
|
||||
for item in soup.select('.gallery figure'):
|
||||
sub = Submission.new_or_cached(self._api, int(item.get('id')[4:])) # IDs look like 'sid-35908275', so we just skip the 'sid-'
|
||||
|
||||
# Try cache the preview URL early
|
||||
try:
|
||||
sub._preview_url = 'https:' + item.select('img')[0].get('src')
|
||||
sub._has_preview = True
|
||||
except IndexError:
|
||||
sub._has_preview = False
|
||||
|
||||
submissions.append(sub)
|
||||
|
||||
return submissions
|
||||
@ -360,6 +368,14 @@ class User:
|
||||
# Get all the submissions on this page
|
||||
for item in soup.select('.gallery figure'):
|
||||
sub = Submission.new_or_cached(self._api, int(item.get('id')[4:])) # IDs look like 'sid-35908275', so we just skip the 'sid-'
|
||||
|
||||
# Try cache the preview URL early
|
||||
try:
|
||||
sub._preview_url = 'https:' + item.select('img')[0].get('src')
|
||||
sub._has_preview = True
|
||||
except IndexError:
|
||||
sub._has_preview = False
|
||||
|
||||
submissions.append(sub)
|
||||
|
||||
return submissions
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user