chore(route): japanpost: update radar rules (#13198)

This commit is contained in:
tuzi3040 2023-09-03 19:54:46 +08:00 committed by GitHub
parent 4b1a103808
commit f57c0df8b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ module.exports = {
docs: 'https://docs.rsshub.app/routes/other#japanpost-ri-ben-you-bian',
source: '/services/srv/search/direct',
target: (params, url) => {
const reqCode = new URL(url).searchParams.get('reqCodeNo1').toUpperCase();
const reqCode = new URL(url).searchParams.get('reqCodeNo1').replace(/[^0-9a-zA-Z]/g, '').toUpperCase();
const locale = new URL(url).searchParams.get('locale').toLowerCase();
if ((reqCode.search(/^(?:\d{11,12}|[A-Z]{2}\d{9}[A-Z]{2})$/) === 0 && locale === 'ja') || locale === 'en') {
return `/japanpost/track/${reqCode}/${locale}`;