Implementing WebVideo
This commit is contained in:
parent
b0cb9ac5ae
commit
10717232c2
@ -16,5 +16,5 @@ BaselineOfVideoWeb >> baseline: spec [
|
||||
|
||||
{ #category : #accessing }
|
||||
BaselineOfVideoWeb >> semanticVersion [
|
||||
^ '0.1.0'
|
||||
^ '0.2.0'
|
||||
]
|
||||
|
@ -149,3 +149,12 @@ Invidious >> uri [
|
||||
Invidious >> uri: urlString [
|
||||
uri := urlString asUrl
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> video: videoId [
|
||||
| dataUrl queryFields dataDict |
|
||||
queryFields := 'videoId,title,description,author,authorId,authorUrl,likeCount,lengthSeconds,videoThumbnails'.
|
||||
dataUrl := (self uri asString, 'api/v1/videos/', videoId, '?fields=', queryFields, '&pretty=1') asUrl.
|
||||
dataDict := STONJSON fromString: dataUrl retrieveContents.
|
||||
^ WebVideo new fromDictionary: dataDict
|
||||
]
|
||||
|
114
app/VideoWeb/WebVideo.class.st
Normal file
114
app/VideoWeb/WebVideo.class.st
Normal file
@ -0,0 +1,114 @@
|
||||
Class {
|
||||
#name : #WebVideo,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'videoId',
|
||||
'author',
|
||||
'title',
|
||||
'lengthSeconds',
|
||||
'description',
|
||||
'authorId',
|
||||
'videoThumbnails',
|
||||
'likeCount'
|
||||
],
|
||||
#category : #VideoWeb
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> author [
|
||||
^ author
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> author: anObject [
|
||||
author := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> authorId [
|
||||
^ authorId
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> authorId: anObject [
|
||||
authorId := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> description [
|
||||
^ description
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> description: anObject [
|
||||
description := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> fromDictionary: aDictionary [
|
||||
^ self author: (aDictionary at: 'author');
|
||||
description: (aDictionary at: 'description');
|
||||
videoId: (aDictionary at: 'videoId');
|
||||
title: (aDictionary at: 'title');
|
||||
authorId: (aDictionary at: 'authorId');
|
||||
lengthSeconds: (aDictionary at: 'lengthSeconds');
|
||||
videoThumbnails: (aDictionary at: 'videoThumbnails');
|
||||
likeCount: (aDictionary at: 'likeCount').
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> lengthSeconds [
|
||||
^ lengthSeconds
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> lengthSeconds: anObject [
|
||||
lengthSeconds := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> likeCount [
|
||||
^ likeCount
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> likeCount: anObject [
|
||||
likeCount := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ', self videoId, ' | ', self title, ' | ', self author, ' )'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> title [
|
||||
^ title
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> title: anObject [
|
||||
title := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> videoId [
|
||||
^ videoId
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> videoId: anObject [
|
||||
videoId := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> videoThumbnails [
|
||||
^ videoThumbnails
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebVideo >> videoThumbnails: anObject [
|
||||
videoThumbnails := anObject
|
||||
]
|
Loading…
Reference in New Issue
Block a user