Skip to content

Commit 73ff7a1

Browse files
committed
Create VideoObject for playlist elements
1 parent e27e7e1 commit 73ff7a1

File tree

4 files changed

+127
-18
lines changed

4 files changed

+127
-18
lines changed

README.md

Lines changed: 5 additions & 4 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,7 +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+
An array of [video objects](spec/video_object).
7273

7374
Each item of the array is an URL representing one video in the playlist.
7475
The array must be sorted in the same order as the videos in the playlist.
@@ -80,7 +81,7 @@ The array must be sorted in the same order as the videos in the playlist.
8081
"name": String,
8182
"visibility": String,
8283
"description": String,
83-
"videos": String[],
84+
"videos": VideoObject[],
8485
}
8586
```
8687

@@ -91,7 +92,7 @@ The watch history is nothing more than a private paylist, without metadata
9192

9293
#### > `"videos"`
9394

94-
An array of `String`.
95+
An array of [video objects](spec/video_object).
9596

9697
Each item of the array is an URL representing one video in the playlist.
9798
The array must be sorted in the same order as the videos in the playlist.
@@ -100,6 +101,6 @@ The array must be sorted in the same order as the videos in the playlist.
100101

101102
```javascript
102103
{
103-
"videos": String[],
104+
"videos": VideoObject[],
104105
}
105106
```

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)