Skip to content

Commit

Permalink
mdn: download search-index.json
Browse files Browse the repository at this point in the history
part of #372
  • Loading branch information
myfreeer committed Jul 25, 2021
1 parent be3d886 commit 8d36eeb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/mdn/process-url/default-initial-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export function defaultInitialUrl(locale: string): string[] {
`https://developer.mozilla.org/${locale}/docs/Games`,
`https://developer.mozilla.org/${locale}/docs/Glossary`,
// https://github.com/website-local/mdn-local/issues/214
`https://developer.mozilla.org/sitemaps/${locale}/sitemap.xml.gz`
`https://developer.mozilla.org/sitemaps/${locale}/sitemap.xml.gz`,
// https://github.com/website-local/mdn-local/issues/372
`https://developer.mozilla.org/${locale}/search-index.json`,
];
if (locale !== 'en-US') {
strings.push('https://developer.mozilla.org/sitemaps/en-US/sitemap.xml.gz');
Expand Down
8 changes: 6 additions & 2 deletions src/mdn/process-url/drop-resource.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {downloadableHosts, localeArr} from './consts';
import type {Resource} from 'website-scrap-engine/lib/resource';
import {downloadableHosts, localeArr, mdnHosts} from './consts';
import {Resource} from 'website-scrap-engine/lib/resource';
import type {StaticDownloadOptions} from 'website-scrap-engine/lib/options';
import URI from 'urijs';
import type {Cheerio} from 'website-scrap-engine/lib/types';
Expand Down Expand Up @@ -30,6 +30,10 @@ export function dropResource(
if (host === 'mdn.mozillademos.org' && path.startsWith('/files')) {
return res;
}
// https://github.com/website-local/mdn-local/issues/372
if (mdnHosts[host] && path === `/${locale}/search-index.json`) {
return res;
}
if (!downloadableHosts[host] ||
testLocaleRegExp(locale).test(path) ||
path.startsWith('/search') ||
Expand Down

0 comments on commit 8d36eeb

Please sign in to comment.