mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
Added config
This commit is contained in:
14
upload.ts
Normal file
14
upload.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export const getTweetID = (src: string): string => {
|
||||
// Create a URL object with the source. If it fails, it's not a URL.
|
||||
const url = new URL(src)
|
||||
const id = url.pathname
|
||||
.split('/')
|
||||
.filter(piece => !!piece) // remove empty strings from array
|
||||
.slice(-1)[0]
|
||||
if (!id) {
|
||||
throw new Error('URL does not seem to be a tweet.')
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user