Reports for localized sites have wrong links to metasmoke
SmokeDetector once reported a post (ID 43945) that was posted to Japanese Stack Overflow: https://chat.meta.stackexchange.com/transcript/message/6947491#6947491

However, the link to metasmoke for that post attempted to find a post on regular (English) Stack Overflow with ID 43945. Understandably, it couldn't find it, because it was the wrong link. It provided [this link](https://m.erwaysoftware.com/posts/uid/stackoverflow/43945), where the proper link was [this](http://metasmoke.erwaysoftware.com/post/119321).
diff --git a/helpers.py b/helpers.py
index 814460fd88..a26d743ea2 100644
--- a/helpers.py
+++ b/helpers.py
@@ -77,11 +77,10 @@ def unshorten_link(url, request_type='HEAD', explicitly_ignore_security_warning=
     return url
 
 
-parser_regex = r'((?:meta\\.)?(?:(?:(?:math|stack)overflow|askubuntu|superuser|serverfault)|\\w+)(?:\\.meta)?)' \\
-               r'\\.(?:stackexchange\\.com|com|net)'
+parser_regex = r'((?:meta\\.)?(?:(?:(?:math|(?:\\w{2}\\.)?stack)overflow|askubuntu|superuser|serverfault)|\\w+)' \\
+               r'(?:\\.meta)?)\\.(?:stackexchange\\.com|com|net)'
 parser = regex.compile(parser_regex)
 exceptions = {
-    'meta.stackoverflow': 'meta.stackoverflow',
     'meta.superuser': 'meta.superuser',
     'meta.serverfault': 'meta.serverfault',
     'meta.askubuntu': 'meta.askubuntu',
@@ -96,7 +95,7 @@ def api_parameter_from_link(link):
     if match:
         if match[1] in exceptions.keys():
             return exceptions[match[1]]
-        elif 'meta.' in match[1]:
+        elif 'meta.' in match[1] and 'stackoverflow' not in match[1]:
             return '.'.join(match[1].split('.')[::-1])
         else:
             return match[1]
diff --git a/test/test_helpers.py b/test/test_helpers.py
index 7f4ebc8231..c98e720d2d 100644
--- a/test/test_helpers.py
+++ b/test/test_helpers.py
@@ -42,7 +42,9 @@ def test_unshorten_link(shortened, original):
     ('meta.askubuntu.com', 'meta.askubuntu'),
     ('3dprinting.meta.stackexchange.com', '3dprinting.meta'),
     ('blender.meta.stackexchange.com', 'blender.meta'),
-    ('meta.stackexchange.com', 'meta')
+    ('meta.stackexchange.com', 'meta'),
+    ('ja.stackoverflow.com', 'ja.stackoverflow'),
+    ('meta.ja.stackoverflow.com', 'meta.ja.stackoverflow')
 ])
 def test_api_parameter_from_link(link, param):
     assert helpers.api_parameter_from_link(link) == param

['test/test_helpers.py', 'helpers.py']