[artstation] add 'max-posts' option (#3270)
This commit is contained in:
@@ -885,6 +885,16 @@ Description
|
||||
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
|
||||
-------------------------------------
|
||||
Type
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text, util, exception
|
||||
import itertools
|
||||
import random
|
||||
import string
|
||||
|
||||
@@ -31,7 +32,12 @@ class ArtstationExtractor(Extractor):
|
||||
def items(self):
|
||||
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(
|
||||
self.get_project_assets(project["hash_id"]), 1):
|
||||
asset.update(data)
|
||||
|
||||
Reference in New Issue
Block a user