Alex Xu 8 ماه پیش
والد
کامیت
6f69401817
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      src/services/twitterService/index.ts

+ 2 - 1
src/services/twitterService/index.ts

@@ -43,7 +43,8 @@ const tweetUrlReg =
 
 
 const removeScriptReg = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi
 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)
   const match = url.match(tweetUrlReg)
   if (!match) {
   if (!match) {
     throw new Error('Invalid tweet URL')
     throw new Error('Invalid tweet URL')