Skip to content

Commit 2c0c33f

Browse files
committed
Create VideoObject for playlist elements
Signed-off-by: Samantaz Fox <[email protected]>
1 parent 70bf5d8 commit 2c0c33f

File tree

5 files changed

+128
-25
lines changed

5 files changed

+128
-25
lines changed

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Indicates whether the special playlist `watch_history` was included in the expor
4545
}
4646
```
4747

48+
4849
## Playlist file (`playlist_xxx.json`)
4950

5051
A playlist file MUST contain the data of a single playlist created by the user.
@@ -68,10 +69,7 @@ CAN be nil; In this case, the parser MUST assume an empty `String`.
6869

6970
#### > `"videos"`
7071

71-
An array of `String`.
72-
73-
Each item of the array is an URL representing one video in the playlist.
74-
The array must be sorted in the same order as the videos in the playlist.
72+
An array of [video objects](spec/video_object).
7573

7674
### Overview
7775

@@ -80,7 +78,7 @@ The array must be sorted in the same order as the videos in the playlist.
8078
"name": String,
8179
"visibility": String,
8280
"description": String,
83-
"videos": String[],
81+
"videos": VideoObject[],
8482
}
8583
```
8684

@@ -91,15 +89,12 @@ The watch history is nothing more than a private paylist, without metadata
9189

9290
#### > `"videos"`
9391

94-
An array of `String`.
95-
96-
Each item of the array is an URL representing one video in the playlist.
97-
The array must be sorted in the same order as the videos in the playlist.
92+
An array of [video objects](spec/video_object).
9893

9994
### Overview
10095

10196
```javascript
10297
{
103-
"videos": String[],
98+
"videos": VideoObject[],
10499
}
105100
```

examples/main.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.0.2-draft",
2+
"version": "0.0.3-draft",
33
"subscriptions": [
44
{
55
"type": "youtube",

examples/playlist_abc123.json

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,47 @@
33
"visibility": "public",
44
"description": "The playlist I listen to every day",
55
"videos": [
6-
"https://www.youtube.com/v/djV11Xbc914",
7-
"https://www.youtube.com/v/HEXWRTEbj1I",
8-
"https://www.youtube.com/v/sRl02nXVMhw",
9-
"https://www.youtube.com/v/dQw4w9WgXcQ",
10-
"https://www.youtube.com/v/Hy8kmNEo1i8",
11-
"https://www.youtube.com/v/zA52uNzx7Y4",
12-
"https://www.youtube.com/v/9bZkp7q19f0"
6+
{
7+
"type": "youtube",
8+
"id": "djV11Xbc914",
9+
"url": "https://www.youtube.com/v/djV11Xbc914",
10+
"thumbnail": "https://i.ytimg.com/vi/djV11Xbc914/default.jpg"
11+
},
12+
{
13+
"type": "youtube",
14+
"id": "HEXWRTEbj1I",
15+
"url": "https://www.youtube.com/v/HEXWRTEbj1I",
16+
"thumbnail": "https://i.ytimg.com/vi/HEXWRTEbj1I/default.jpg"
17+
},
18+
{
19+
"type": "youtube",
20+
"id": "sRl02nXVMhw",
21+
"url": "https://www.youtube.com/v/sRl02nXVMhw",
22+
"thumbnail": "https://i.ytimg.com/vi/sRl02nXVMhw/default.jpg"
23+
},
24+
{
25+
"type": "youtube",
26+
"id": "dQw4w9WgXcQ",
27+
"url": "https://www.youtube.com/v/dQw4w9WgXcQ",
28+
"thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg"
29+
},
30+
{
31+
"type": "youtube",
32+
"id": "Hy8kmNEo1i8",
33+
"url": "https://www.youtube.com/v/Hy8kmNEo1i8",
34+
"thumbnail": "https://i.ytimg.com/vi/Hy8kmNEo1i8/default.jpg"
35+
},
36+
{
37+
"type": "youtube",
38+
"id": "zA52uNzx7Y4",
39+
"url": "https://www.youtube.com/v/zA52uNzx7Y4",
40+
"thumbnail": "https://i.ytimg.com/vi/zA52uNzx7Y4/default.jpg"
41+
},
42+
{
43+
"type": "youtube",
44+
"id": "9bZkp7q19f0",
45+
"url": "https://www.youtube.com/v/9bZkp7q19f0",
46+
"thumbnail": "https://i.ytimg.com/vi/9bZkp7q19f0/default.jpg"
47+
}
1348
]
1449
}

examples/watch_history.json

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
11
{
22
"videos": [
3-
"https://www.youtube.com/v/djV11Xbc914",
4-
"https://www.youtube.com/v/HEXWRTEbj1I",
5-
"https://www.youtube.com/v/sRl02nXVMhw",
6-
"https://www.youtube.com/v/dQw4w9WgXcQ",
7-
"https://www.youtube.com/v/Hy8kmNEo1i8",
8-
"https://www.youtube.com/v/zA52uNzx7Y4",
9-
"https://www.youtube.com/v/9bZkp7q19f0"
3+
{
4+
"type": "youtube",
5+
"id": "djV11Xbc914",
6+
"url": "https://www.youtube.com/v/djV11Xbc914",
7+
"thumbnail": "https://i.ytimg.com/vi/djV11Xbc914/default.jpg"
8+
},
9+
{
10+
"type": "youtube",
11+
"id": "HEXWRTEbj1I",
12+
"url": "https://www.youtube.com/v/HEXWRTEbj1I",
13+
"thumbnail": "https://i.ytimg.com/vi/HEXWRTEbj1I/default.jpg"
14+
},
15+
{
16+
"type": "youtube",
17+
"id": "sRl02nXVMhw",
18+
"url": "https://www.youtube.com/v/sRl02nXVMhw",
19+
"thumbnail": "https://i.ytimg.com/vi/sRl02nXVMhw/default.jpg"
20+
},
21+
{
22+
"type": "youtube",
23+
"id": "dQw4w9WgXcQ",
24+
"url": "https://www.youtube.com/v/dQw4w9WgXcQ",
25+
"thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg"
26+
},
27+
{
28+
"type": "youtube",
29+
"id": "Hy8kmNEo1i8",
30+
"url": "https://www.youtube.com/v/Hy8kmNEo1i8",
31+
"thumbnail": "https://i.ytimg.com/vi/Hy8kmNEo1i8/default.jpg"
32+
},
33+
{
34+
"type": "youtube",
35+
"id": "zA52uNzx7Y4",
36+
"url": "https://www.youtube.com/v/zA52uNzx7Y4",
37+
"thumbnail": "https://i.ytimg.com/vi/zA52uNzx7Y4/default.jpg"
38+
},
39+
{
40+
"type": "youtube",
41+
"id": "9bZkp7q19f0",
42+
"url": "https://www.youtube.com/v/9bZkp7q19f0",
43+
"thumbnail": "https://i.ytimg.com/vi/9bZkp7q19f0/default.jpg"
44+
}
1045
]
1146
}

spec/video_object.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Video object
2+
3+
#### > `"type"`
4+
5+
The type of the service this entry refers to.
6+
7+
This field is a short and meaningful identifier that prevents the parser from
8+
trying to guess the name of the service from the `url` present in this object.
9+
10+
#### > `"id"`
11+
12+
The ID of the video.
13+
14+
The format if this ID is service-dependant.
15+
16+
The only requirement being the uniqueness of the ID in the service.
17+
E.g: All youtube video IDs (11 character long) are unique to eachother.
18+
19+
#### > `"url"`
20+
21+
The URL used to access the video.
22+
23+
This URL SHOULD NOT contain query parameters.
24+
25+
#### > `"thumbnail"`
26+
27+
The URL to the video's thumbnail.
28+
29+
### Overview
30+
31+
```javascript
32+
{
33+
"type": String,
34+
"id": String,
35+
"url": String,
36+
"thumbnail": String
37+
}
38+
```

0 commit comments

Comments
 (0)