recycleactor commited on
Commit
7ff7a07
·
verified ·
1 Parent(s): 127cc56

Upload server.js

Browse files
Files changed (1) hide show
  1. server.js +15 -4
server.js CHANGED
@@ -687,13 +687,24 @@ const server = http.createServer(async (req, res) => {
687
  if (!results.find(r => r.id === id)) results.push({ url, id, slug: slug || '' });
688
  };
689
 
690
- const reHref = /href\s*=\s*["']([^"']*?\/(\d+)-([^"'/]+)\.html(?:#[^"']*)?)["']/g;
691
- const reEscAbs = /(https?:\\\\\/\\\\\/uakinogo\.io\\\\\/[^"']*?\\\\\/(\d+)-([^"\\\/]+)\.html)/g;
692
- const reEscRel = /(\\\\\/[^"']*?\\\\\/(\d+)-([^"\\\/]+)\.html)/g;
 
 
 
 
693
  let m;
694
- while ((m = reHref.exec(html)) !== null) addResult(m[1], m[2], m[3]);
 
 
 
 
 
695
  while ((m = reEscAbs.exec(html)) !== null) addResult(m[1].replace(/\\\\\//g, '/'), m[2], m[3]);
696
  while ((m = reEscRel.exec(html)) !== null) addResult(m[1].replace(/\\\\\//g, '/'), m[2], m[3]);
 
 
697
  return results;
698
  };
699
 
 
687
  if (!results.find(r => r.id === id)) results.push({ url, id, slug: slug || '' });
688
  };
689
 
690
+ const reHrefAny = /href\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+))/gi;
691
+ const reIdSlug = /\/(\d+)-([^\/?#"'<>]+)\.html/i;
692
+ const reEscAbs = /(https?:\\\\\/\\\\\/uakinogo\.io\\\\\/[^"']*?\\\\\/(\d+)-([^"\\\/]+)\.html)/gi;
693
+ const reEscRel = /(\\\\\/[^"']*?\\\\\/(\d+)-([^"\\\/]+)\.html)/gi;
694
+ const reLoose = /(https?:\/\/uakinogo\.io\/[^"'<>\\s]*\/(\d+)-([^\/?#"'<>\\s]+)\.html)/gi;
695
+ const reLooseRel = /(\/[^"'<>\\s]*\/(\d+)-([^\/?#"'<>\\s]+)\.html)/gi;
696
+
697
  let m;
698
+ while ((m = reHrefAny.exec(html)) !== null) {
699
+ const href = (m[1] || m[2] || m[3] || '').trim();
700
+ if (!href) continue;
701
+ const mm = href.match(reIdSlug);
702
+ if (mm) addResult(href, mm[1], mm[2]);
703
+ }
704
  while ((m = reEscAbs.exec(html)) !== null) addResult(m[1].replace(/\\\\\//g, '/'), m[2], m[3]);
705
  while ((m = reEscRel.exec(html)) !== null) addResult(m[1].replace(/\\\\\//g, '/'), m[2], m[3]);
706
+ while ((m = reLoose.exec(html)) !== null) addResult(m[1], m[2], m[3]);
707
+ while ((m = reLooseRel.exec(html)) !== null) addResult(m[1], m[2], m[3]);
708
  return results;
709
  };
710