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
|
# Get all the submissions on this page
|
||||||
for item in soup.select('.gallery figure'):
|
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-'
|
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)
|
submissions.append(sub)
|
||||||
|
|
||||||
return submissions
|
return submissions
|
||||||
@ -360,6 +368,14 @@ class User:
|
|||||||
# Get all the submissions on this page
|
# Get all the submissions on this page
|
||||||
for item in soup.select('.gallery figure'):
|
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-'
|
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)
|
submissions.append(sub)
|
||||||
|
|
||||||
return submissions
|
return submissions
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='FAAPI',
|
name='FAAPI',
|
||||||
version='0.4.0',
|
version='0.4.2',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
url='https://tem.party/gitea/tom/FAAPI',
|
url='https://tem.party/gitea/tom/FAAPI',
|
||||||
license='WTFPL',
|
license='WTFPL',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user