Starting package.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-12-28 15:59:08 -05:00
parent 65fab3a34e
commit 510fdb03e4
2 changed files with 70 additions and 0 deletions

View 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
View File

@ -0,0 +1 @@
Package { #name : #VideoWeb }