Ver código fonte

인스타그램 트위터 매크로 추가

https://github.com/openNAMU/openNAMU/issues/2062
잉여개발기 (SPDV) 2 anos atrás
pai
commit
4c90c0ba6a
2 arquivos alterados com 16 adições e 2 exclusões
  1. 15 1
      route/tool/func_render_namumark.py
  2. 1 1
      version.json

+ 15 - 1
route/tool/func_render_namumark.py

@@ -481,15 +481,23 @@ class class_do_render_namumark:
 
 
             macro_split_regex = r'(?:^|,) *([^,]+)'
             macro_split_regex = r'(?:^|,) *([^,]+)'
             macro_split_sub_regex = r'(^[^=]+) *= *([^=]+)'
             macro_split_sub_regex = r'(^[^=]+) *= *([^=]+)'
-            if name_data in ('youtube', 'nicovideo', 'navertv', 'kakaotv', 'vimeo'):
+            if name_data in ('youtube', 'nicovideo', 'navertv', 'kakaotv', 'vimeo', 'instagram', 'twitter'):
                 data = re.findall(macro_split_regex, match[1])
                 data = re.findall(macro_split_regex, match[1])
 
 
                 # get option
                 # get option
                 video_code = ''
                 video_code = ''
                 video_start = ''
                 video_start = ''
                 video_end = ''
                 video_end = ''
+                
                 video_width = '640px'
                 video_width = '640px'
                 video_height = '360px'
                 video_height = '360px'
+                if name_data == 'instagram':
+                    video_width = '360px'
+                    video_height = '480px'
+                elif name_data == 'twitter':
+                    video_width = '480px'
+                    video_height = '480px'
+
                 for for_a in data:
                 for for_a in data:
                     data_sub = re.search(macro_split_sub_regex, for_a)
                     data_sub = re.search(macro_split_sub_regex, for_a)
                     if data_sub:
                     if data_sub:
@@ -523,6 +531,12 @@ class class_do_render_namumark:
                     else:
                     else:
                         if video_end != '':
                         if video_end != '':
                             video_code += '?end=' + video_end
                             video_code += '?end=' + video_end
+                elif name_data == 'instagram':
+                    video_code = re.sub(r'^https:\/\/www\.instagram\.com\/p\/', '', video_code)
+
+                    video_code = 'https://www.instagram.com/p/' + video_code +'/embed/'
+                elif name_data == 'twitter':
+                    video_code = 'https://twitframe.com/show?url=' + video_code
                 elif name_data == 'kakaotv':
                 elif name_data == 'kakaotv':
                     video_code = re.sub(r'^https:\/\/tv\.kakao\.com\/v\/', '', video_code)
                     video_code = re.sub(r'^https:\/\/tv\.kakao\.com\/v\/', '', video_code)
 
 

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
 {
     "beta" : {
     "beta" : {
-        "r_ver" : "v3.5.0-dev5",
+        "r_ver" : "v3.5.0-dev6",
         "c_ver" : "3500374",
         "c_ver" : "3500374",
         "s_ver" : "3500113"
         "s_ver" : "3500113"
     }
     }