Skip to content

Instantly share code, notes, and snippets.

@lionel-rowe
Last active January 28, 2022 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lionel-rowe/4314cde083aad1103c47c11d4223590c to your computer and use it in GitHub Desktop.
Save lionel-rowe/4314cde083aad1103c47c11d4223590c to your computer and use it in GitHub Desktop.
// https://web.archive.org/web/20160920191749/http://zhaoren.idtag.cn/samename/searchName!pmbyrepeatlist.htm
const 姓名 = [...document.querySelectorAll('li p')]
.map(x => x.textContent.trim().match(/^\d+\.(.+)$/))
.filter(Boolean)
.map(x => x[1])
const 姓 = [...new Set(姓名.map(x => x[0]))].join('')
const 名 = [...new Set(姓名.flatMap(x => [...x.slice(1)]))].join('')
console.log({ 姓, 名 })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment