This repository has been archived by the owner on Nov 11, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyoutube.js
72 lines (69 loc) · 2.02 KB
/
youtube.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
var arr = [];
$$('ytd-playlist-panel-video-renderer > a').forEach(function (element) {
console.log(element.href);
var videoURL = new URL(element.href);
var videoURLParams = videoURL.searchParams;
var videoID = videoURLParams.get('v')
console.log(videoURLParams.get('v'));
var noembedURL = 'https://noembed.com/embed?url=http://www.youtube.com/watch?v=' + videoID;
/**
* ,{
"date": "2020-01-20T13:05:07.000Z",
"site": "ServiceNow HI Videos",
"category": "YouTube",
"title": "Troubleshooting a Failed Discovery Part 2 of 5: Scanning Phase",
"author": "",
"link": ""
},{
*/
fetch(noembedURL)
.then(async r => (
//console.log(await (r.json()))
arr.push(await r.json())
)
)
.catch(e => console.error('Boo...' + e));
//No fear...
(async () =>
console.log(
(await (await fetch(jsonURL)).json()), '... from async'
)
)();
});
var feed = arr.map(function(video){
return {
date: new Date().toISOString(),
site: "ServiceNow Events",
category: "YouTube",
title: video.title,
author: video.author_name,
link: video.url
}
})
//https://hi.service-now.com/kb_view.do?sys_kb_id=d5da8270db749450f7fca851ca9619cf&sysparm_rank=16&sysparm_tsqueryId=dbbe41acdb291810f7fca851ca9619fc
/**
* var arr = [];
$$('.cm-content-header > a').forEach(function (element) {
//console.log($(element).text());
//console.log(element.href);
//console.log(element);
arr.push({
"date": "2019-05-05T00:00:00.000Z",
"site": "Knowledge 19",
"category": "Presentation",
"title": $(element).text(),
"author": "Miscellaneous",
"link": element.href
})
/**
* ,{
"date": "2020-01-20T13:05:07.000Z",
"site": "ServiceNow HI Videos",
"category": "YouTube",
"title": "Troubleshooting a Failed Discovery Part 2 of 5: Scanning Phase",
"author": "",
"link": ""
},{
});
console.log(arr);
*/