[artstation] add 'max-posts' option (#3270)
This commit is contained in:
@@ -885,6 +885,16 @@ Description
|
|||||||
Try to follow external URLs of embedded players.
|
Try to follow external URLs of embedded players.
|
||||||
|
|
||||||
|
|
||||||
|
extractor.artstation.max-posts
|
||||||
|
------------------------------
|
||||||
|
Type
|
||||||
|
``integer``
|
||||||
|
Default
|
||||||
|
``null``
|
||||||
|
Description
|
||||||
|
Limit the number of posts/projects to download.
|
||||||
|
|
||||||
|
|
||||||
extractor.artstation.search.pro-first
|
extractor.artstation.search.pro-first
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
from .common import Extractor, Message
|
from .common import Extractor, Message
|
||||||
from .. import text, util, exception
|
from .. import text, util, exception
|
||||||
|
import itertools
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
@@ -31,7 +32,12 @@ class ArtstationExtractor(Extractor):
|
|||||||
def items(self):
|
def items(self):
|
||||||
data = self.metadata()
|
data = self.metadata()
|
||||||
|
|
||||||
for project in self.projects():
|
projects = self.projects()
|
||||||
|
max_posts = self.config("max-posts")
|
||||||
|
if max_posts:
|
||||||
|
projects = itertools.islice(projects, max_posts)
|
||||||
|
|
||||||
|
for project in projects:
|
||||||
for num, asset in enumerate(
|
for num, asset in enumerate(
|
||||||
self.get_project_assets(project["hash_id"]), 1):
|
self.get_project_assets(project["hash_id"]), 1):
|
||||||
asset.update(data)
|
asset.update(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user