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