const comments = JSON.parse(window.localStorage.getItem('my_comments'))
let text = 'My top 3 comments:\n\n'
comments.slice(0, 3).forEach((comment) => {
text = text + `- ${comment.score} - ${comment.link} - ${comment.timestamp} - Story: ${comment.onstory} - Comment: ${JSON.stringify(comment.intro)}\n\n`
})
text = text + 'My 3 worst comments:\n\n'
comments.slice(-3).forEach((comment) => {
text = text + `- ${comment.score} - ${comment.link} - ${comment.timestamp} - Story: ${comment.onstory} - Comment: ${JSON.stringify(comment.intro)}\n\n`
})
copy(text)
Please note that you need to run the script from the submission before you can run the above script.Example output:
My top 3 comments:
- 180 - https://news.ycombinator.com/item?id=35800744 - 2023-05-03T10:56:58 - Story: MSFT is forcing Outlook and Teams to open links in... - Comment: "> Microsoft needs to think hard how hostile they want to be to its competitors and users, because tw"
- 107 - https://news.ycombinator.com/item?id=34788180 - 2023-02-14T12:01:03 - Story: BBC offices in India raided by tax officials amid ... - Comment: "> If you're interested, you can get it (legally) in the UK here\n\nAnd if you happen to be belong to t"
- 76 - https://news.ycombinator.com/item?id=35264026 - 2023-03-22T17:06:50 - Story: DPReview is being archived by the Archive Team - Comment: "The title is wrong, Archive Team (https://wiki.archiveteam.org/) is behind these archiving efforts, "
My 3 worst comments:
- -4 - https://news.ycombinator.com/item?id=35414789 - 2023-04-02T20:24:14 - Story: Windows Sandbox - Comment: "Except Docker containers doesn't actually run on Windows as they do on Linux (Linux containers that "
- -4 - https://news.ycombinator.com/item?id=35236819 - 2023-03-20T18:59:55 - Story: ChatGPT is down - Comment: "It's also due to rumored invasion of the US.\n\nCome on, we can do better than spreading unverified \"r"
- -4 - https://news.ycombinator.com/item?id=35153482 - 2023-03-14T15:49:54 - Story: null - Comment: "Ah, it seems you're one of many who confuses \"crypto\" with cryptography and cryptocurrency. Cryptogr"