[behance] fix 'collection' extraction

This commit is contained in:
Mike Fährmann
2021-08-10 00:48:31 +02:00
parent 229498b8aa
commit f9096584ab

View File

@@ -217,236 +217,253 @@ class BehanceCollectionExtractor(BehanceExtractor):
query = """ query = """
query GetMoodboardItemsAndRecommendations( query GetMoodboardItemsAndRecommendations(
$id: Int! $id: Int!
$firstItem: Int! $firstItem: Int!
$afterItem: String $afterItem: String
$shouldGetRecommendations: Boolean! $shouldGetRecommendations: Boolean!
$shouldGetItems: Boolean! $shouldGetItems: Boolean!
$shouldGetMoodboardFields: Boolean! $shouldGetMoodboardFields: Boolean!
) { ) {
viewer @include(if: $shouldGetMoodboardFields) { viewer @include(if: $shouldGetMoodboardFields) {
isOptedOutOfRecommendations isOptedOutOfRecommendations
} isAdmin
moodboard(id: $id) { }
...moodboardFields @include(if: $shouldGetMoodboardFields) moodboard(id: $id) {
...moodboardFields @include(if: $shouldGetMoodboardFields)
items(first: $firstItem, after: $afterItem) @include(if: $shouldGetItems) items(first: $firstItem, after: $afterItem) @include(if: $shouldGetItems) {
{ pageInfo {
pageInfo { endCursor
endCursor hasNextPage
hasNextPage
}
nodes {
...nodesFields
}
} }
nodes {
...nodesFields
}
}
recommendedItems(first: 80) @include(if: $shouldGetRecommendations) { recommendedItems(first: 80) @include(if: $shouldGetRecommendations) {
nodes { nodes {
...nodesFields ...nodesFields
fetchSource fetchSource
}
} }
} }
} }
}
fragment moodboardFields on Moodboard { fragment moodboardFields on Moodboard {
id
label
privacy
followerCount
isFollowing
projectCount
url
isOwner
owners {
id id
label displayName
privacy url
followerCount firstName
location
locationUrl
isFollowing isFollowing
projectCount images {
url size_50 {
isOwner
owners {
id
displayName
url
firstName
location
locationUrl
images {
size_50 {
url
}
size_100 {
url
}
size_115 {
url
}
size_230 {
url
}
size_138 {
url
}
size_276 {
url
}
}
}
}
fragment projectFields on Project {
id
isOwner
publishedOn
matureAccess
hasMatureContent
modifiedOn
name
url
isPrivate
slug
fields {
label
}
colors {
r
g
b
}
owners {
url
displayName
id
location
locationUrl
isProfileOwner
images {
size_50 {
url
}
size_100 {
url
}
size_115 {
url
}
size_230 {
url
}
size_138 {
url
}
size_276 {
url
}
}
}
covers {
size_original {
url url
} }
size_max_808 { size_100 {
url
}
size_808 {
url
}
size_404 {
url
}
size_202 {
url
}
size_230 {
url url
} }
size_115 { size_115 {
url url
} }
} size_230 {
stats { url
views {
all
} }
appreciations { size_138 {
all url
} }
comments { size_276 {
all url
} }
} }
} }
}
fragment exifDataValueFields on exifDataValue { fragment projectFields on Project {
id
isOwner
publishedOn
matureAccess
hasMatureContent
modifiedOn
name
url
isPrivate
slug
license {
license
description
id id
label label
value url
searchValue text
images
} }
fields {
fragment nodesFields on MoodboardItem { label
}
colors {
r
g
b
}
owners {
url
displayName
id id
entityType location
width locationUrl
height isProfileOwner
flexWidth isFollowing
flexHeight
images { images {
size size_50 {
url
}
size_100 {
url
}
size_115 {
url
}
size_230 {
url
}
size_138 {
url
}
size_276 {
url
}
}
}
covers {
size_original {
url url
} }
size_max_808 {
url
}
size_808 {
url
}
size_404 {
url
}
size_202 {
url
}
size_230 {
url
}
size_115 {
url
}
}
stats {
views {
all
}
appreciations {
all
}
comments {
all
}
}
}
entity { fragment exifDataValueFields on exifDataValue {
... on Project { id
label
value
searchValue
}
fragment nodesFields on MoodboardItem {
id
entityType
width
height
flexWidth
flexHeight
images {
size
url
}
entity {
... on Project {
...projectFields
}
... on ImageModule {
project {
...projectFields ...projectFields
} }
... on ImageModule { colors {
project { r
...projectFields g
} b
exifData {
lens {
...exifDataValueFields
}
software {
...exifDataValueFields
}
makeAndModel {
...exifDataValueFields
}
focalLength {
...exifDataValueFields
}
iso {
...exifDataValueFields
}
location {
...exifDataValueFields
}
flash {
...exifDataValueFields
}
exposureMode {
...exifDataValueFields
}
shutterSpeed {
...exifDataValueFields
}
aperture {
...exifDataValueFields
}
}
} }
... on MediaCollectionComponent { exifData {
project { lens {
...projectFields ...exifDataValueFields
}
software {
...exifDataValueFields
}
makeAndModel {
...exifDataValueFields
}
focalLength {
...exifDataValueFields
}
iso {
...exifDataValueFields
}
location {
...exifDataValueFields
}
flash {
...exifDataValueFields
}
exposureMode {
...exifDataValueFields
}
shutterSpeed {
...exifDataValueFields
}
aperture {
...exifDataValueFields
} }
} }
} }
... on MediaCollectionComponent {
project {
...projectFields
}
}
} }
}
""" """
variables = { variables = {
"afterItem": "MAo=", "afterItem": "MAo=",
"firstItem": 40, "firstItem": 40,
"id" : self.collection_id, "id" : int(self.collection_id),
"shouldGetItems" : True, "shouldGetItems" : True,
"shouldGetMoodboardFields": False, "shouldGetMoodboardFields": False,
"shouldGetRecommendations": False, "shouldGetRecommendations": False,