Starting package.
This commit is contained in:
parent
65fab3a34e
commit
510fdb03e4
69
app/VideoWeb/Invidious.class.st
Normal file
69
app/VideoWeb/Invidious.class.st
Normal file
@ -0,0 +1,69 @@
|
||||
"
|
||||
I model the API for the [Invidious](https://invidious.io/) open source front-end for YouTube.
|
||||
"
|
||||
Class {
|
||||
#name : #Invidious,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'uri',
|
||||
'region',
|
||||
'api'
|
||||
],
|
||||
#category : #VideoWeb
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious class >> instances [
|
||||
|
||||
^ self rawInstances collect: [ :instanceData |
|
||||
| instanceDict |
|
||||
instanceDict := instanceData second.
|
||||
Invidious new fromDictionary: instanceDict ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious class >> rawInstances [
|
||||
^ STON
|
||||
fromString: 'https://api.invidious.io/instances.json?sort_by=type,users' asUrl
|
||||
retrieveContents
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> api: booleanValue [
|
||||
(booleanValue = 'true')
|
||||
ifTrue: [ api := true ] ifFalse: [ api := false ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> fromDictionary: aDictionary [
|
||||
self
|
||||
uri: (aDictionary at: 'uri');
|
||||
region: (aDictionary at: 'region');
|
||||
api: (aDictionary at: 'api')
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
^ aStream nextPutAll: ' ( ', self uri asString, ' | ', self region, ' ) '
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> region [
|
||||
^ region
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> region: countryISOCode [
|
||||
region := countryISOCode
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> uri [
|
||||
^ uri
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Invidious >> uri: urlString [
|
||||
uri := urlString asUrl
|
||||
]
|
1
app/VideoWeb/package.st
Normal file
1
app/VideoWeb/package.st
Normal file
@ -0,0 +1 @@
|
||||
Package { #name : #VideoWeb }
|
Loading…
Reference in New Issue
Block a user