Improved channel data adquisition from API and latest videos.
This commit is contained in:
parent
8219ae207f
commit
8ae222297a
@ -83,9 +83,10 @@ Invidious >> authorIdForVideo: aString [
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> channel: authorId [
|
||||
| queryURL |
|
||||
| queryURL dataDict |
|
||||
queryURL := self uri asString, 'api/v1/channels/', authorId .
|
||||
^ STONJSON fromString: queryURL asUrl retrieveContents
|
||||
dataDict := STONJSON fromString: queryURL asUrl retrieveContents.
|
||||
^ VideoChannel new fromDictionary: dataDict
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@ -66,6 +66,23 @@ VideoChannel >> description: anObject [
|
||||
description := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
VideoChannel >> fromDictionary: aDictionary [
|
||||
| lastestVideosArray |
|
||||
self author: (aDictionary at: 'author');
|
||||
authorId: (aDictionary at: 'authorId');
|
||||
authorThumbnails: (aDictionary at: 'authorThumbnails');
|
||||
description: (aDictionary at: 'description');
|
||||
isFamilyFriendly: (aDictionary at: 'isFamilyFriendly');
|
||||
relatedChannels: (aDictionary at: 'relatedChannels');
|
||||
subscribersCount: (aDictionary at: 'subCount');
|
||||
totalViews: (aDictionary at: 'totalViews').
|
||||
lastestVideosArray := (aDictionary at: 'latestVideos' ).
|
||||
lastestVideosArray do: [ :videoData |
|
||||
self latestVideos add: (WebVideo new fromDictionary: videoData ) ].
|
||||
^ self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
VideoChannel >> isFamilyFriendly [
|
||||
^ isFamilyFriendly
|
||||
@ -78,7 +95,7 @@ VideoChannel >> isFamilyFriendly: anObject [
|
||||
|
||||
{ #category : #accessing }
|
||||
VideoChannel >> latestVideos [
|
||||
^ latestVideos
|
||||
^ latestVideos ifNil: [ latestVideos := OrderedCollection new]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@ -86,6 +103,13 @@ VideoChannel >> latestVideos: anObject [
|
||||
latestVideos := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
VideoChannel >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: ' ( ', self author, ' | ', self authorId, ' | ', self description, ' )'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
VideoChannel >> relatedChannels [
|
||||
^ relatedChannels
|
||||
|
@ -65,7 +65,7 @@ WebVideo >> fromDictionary: aDictionary [
|
||||
authorId: (aDictionary at: 'authorId');
|
||||
lengthSeconds: (aDictionary at: 'lengthSeconds');
|
||||
videoThumbnails: (aDictionary at: 'videoThumbnails');
|
||||
likeCount: (aDictionary at: 'likeCount').
|
||||
likeCount: (aDictionary at: 'likeCount' ifAbsentPut: [ nil ]).
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user