Hey, sorry for the vague title*, I have the following problem: I would like to scrape the URL's and Title's of Lightnovel's I'm reading and insert it into my Database, while each ChapterUrl matches the ChapterTitle.I would like the endresult structurely look like this in my Database :LightNovel:{chapters:{chapter1:{chapterUrl: String,chapterTitle: StringchapterUpdate: Date()},chapter2:{chapterUrl: String,chapterTitle: StringchapterUpdate: Date()}, etc...}}I would like to have an Object structure like LightNovel.?chapters.?chapter1.?chapterUrlSo far i can scrape each title and url with these line's of code:let ChapterTitle = await page.$$eval('.div class .div class .div class a', a => a.map(title=> title.textContent.trim()));// Will get me the title and returns me an array of titles.&&let ChapterUrl await page.$$eval('.div class .div class .div class a', ahref => ahref.map(link => link.href));// Will get me the Url and returns me an array of linksWhen i scrape these things individualy I get for each an array of content, and when inserting it into the Database it looks structurely like this:chapters: objectchapterTitle: Array ( Array of every title)chapterUrl: Array (Array of every link)so far so good, I mean that is what I wrote in code in the end...but i would like each scapred URL match the title, as mentioned above .Question:How would i need handle this problem in order to get my desired endresult?I hope i could make myself understood and am grateful for any answer / help / guidance regarding this matter.
Submitted September 19, 2020 at 10:00PM by ProjectApprentice
No comments:
Post a Comment