-
Notifications
You must be signed in to change notification settings - Fork 0
/
old.js
153 lines (139 loc) · 7.7 KB
/
old.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//module.exports = ksk;
//console.log($(element).text());
//console.log(label,extLink)
// mdTitle.push($(element).text());
// testArr[index] = $(element).text();
// // if ($(element).text() == 'Tag') {
// // $(element).parent().find('div >a').each(function (ind, el) {
// // newTagsArr.push(mdData.push($(el).text()))
// // })
// // dataTest[index] = newTagsArr;
// // }
// if ($(element).text() == 'Metadata') {
// $(element).parent().find('div >a').each(function (ind, el) {
// //console.log($(el).attr('href'))
// mdData.push($(el).attr('href'))
// dataTest[index] = $(el).attr('href')
// })
// }
// if (
// $(element).text() == 'Size (Ori.)' ||
// $(element).text() == 'Size (Res.)'
// ) {
// let el = $(element).parent().find('div >div >span').html();
// console.log(el)
// mdData.push(el)
// dataTest[index] = el
// }
// if (
// $(element).text() == 'Uploaded' ||
// $(element).text() == 'Archived' ||
// $(element).text() == 'Published' ||
// $(element).text() == 'Updated'
// ) {
// console.log($(element).parent().find('div >time').attr('data-timestamp'))
// dataTest[index] = $(element).parent().find('div >time').attr('data-timestamp')
// }
// if (
// $(element).text() == 'Tag') {
// }
// $(element).parent().find('div >a').each(function (ind, el) {
// mdData.push($(el).text())
// dataTest[index] = $(el).text()
// })
// });
// console.log(mdTitle, mdData)
// // for (let i =0)
// console.log("Test,", testArr, dataTest, "Tags:", newTagsArr)
return
// let title = res.$('#metadata').children('h1').text();
// if (title == undefined || title == '') {
// metaData = { 'sucess': false }
// reject(metaData)
// return
// }
// let full_title = res.$('#metadata').children('h2').text();
// var list = [];
// $('#metadata').find('div >div >a').each(function (index, element) {
// list.push($(element).attr('title'));
// });
// let authors = [];
// let tags = [];
// var link = '';
// var links = [];
// var publisher = '';
// var unixDate = '';
// list.forEach(el => {
// if (el == undefined) {
// return;
// }
// if (el.includes('Artist')) { //for Artist
// var artist = (el.replace('Artist: ', ''))
// authors.push({
// "name": artist,
// "role": "Artist"
// })
// }
// if (el.includes('Circle')) { //for Circle
// var circle = (el.replace('Circle: ', ''))
// authors.push({
// "name": circle,
// "role": "Circle"
// })
// }
// if (el.includes('Tag')) {
// var tag = (el.replace('Tag: ', ''))
// tags.push(tag);
// }
// });
// links.push({
// "label": 'ksk.moe',
// "url": kskUrl
// })
// res.$('#metadata .l').last().find('a').each(function (index, element) {
// //console.log($(element).attr('title'));
// if ($(element).attr('title') == undefined) {
// publisher = ($(element).text().replace(/\n/g, ''))
// link = ($(element).attr('href'));
// links.push({
// "label": publisher,
// "url": link
// })
// } else if (($(element).attr('title').includes('Page'))) {
// //no publisher it's page
// } else {
// publisher = ($(element).text().replace(/\n/g, ''))
// link = ($(element).attr('href'));
// links.push({
// "label": publisher,
// "url": link
// })
// }
// //console.log($(element).attr('href'))
// });
// let date, pubDate, imgUrl;
// res.$('#metadata .createdAt').each((index, element) => {
// unixDate = ($(element).attr('data-timestamp'))
// date = new Date(unixDate * 1000);
// //console.log(date.toLocaleDateString("default"));
// });
// res.$('#metadata .publishedAt').each((index, element) => {
// unixDate = ($(element).attr('data-timestamp'))
// pubDate = new Date(unixDate * 1000);
// //console.log(date.toLocaleDateString("default"));
// });
// res.$('.wrapper').find('img').each((index, element) => {
// imgUrl = ($(element).attr('src'))
// });
// metaData = {
// "sucess": true,
// "title": title,
// 'full_title': full_title,
// 'thumbnail': imgUrl,
// "authors": authors,
// "tags": tags,
// 'publisher': publisher,
// "links": links,
// "created_date": date,
// "published_date": pubDate
//}