|
@@ -43,7 +43,8 @@ const tweetUrlReg =
|
|
|
|
|
|
const removeScriptReg = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi
|
|
|
|
|
|
-async function genenrateTweetByPublishAPI(url: string): Promise<Tweet> {
|
|
|
+async function genenrateTweetByPublishAPI(urlRaw: string): Promise<Tweet> {
|
|
|
+ const url = urlRaw.trim()
|
|
|
const match = url.match(tweetUrlReg)
|
|
|
if (!match) {
|
|
|
throw new Error('Invalid tweet URL')
|