mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
remove redundant async
This commit is contained in:
parent
079857d6c0
commit
486f22a594
2 changed files with 4 additions and 4 deletions
|
|
@ -64,7 +64,7 @@ const fetchContentWithScrapingBee = async (url) => {
|
|||
return { title: dom.title, domContent: dom.documentElement.outerHTML, url: url }
|
||||
}
|
||||
|
||||
const enableJavascriptForUrl = async (url) => {
|
||||
const enableJavascriptForUrl = (url) => {
|
||||
try {
|
||||
const u = new URL(url);
|
||||
for (const host of NON_SCRIPT_HOSTS) {
|
||||
|
|
@ -432,7 +432,7 @@ async function retrievePage(url) {
|
|||
const context = await browser.createIncognitoBrowserContext();
|
||||
const page = await context.newPage()
|
||||
|
||||
if (!await enableJavascriptForUrl(url)) {
|
||||
if (!enableJavascriptForUrl(url)) {
|
||||
await page.setJavaScriptEnabled(false);
|
||||
}
|
||||
await page.setUserAgent(userAgentForUrl(url));
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ var testcaseRoot = path.join(__dirname, "test-pages");
|
|||
var argURL = process.argv[3]; // Could be undefined, we'll warn if it is if that is an issue.
|
||||
|
||||
const NON_SCRIPT_HOSTS= ['medium.com', 'fastcompany.com'];
|
||||
const enableJavascriptForUrl = async (url) => {
|
||||
const enableJavascriptForUrl = (url) => {
|
||||
try {
|
||||
const u = new URL(url);
|
||||
for (const host of NON_SCRIPT_HOSTS) {
|
||||
|
|
@ -74,7 +74,7 @@ async function fetchSource(url, callbackFn) {
|
|||
});
|
||||
|
||||
const page = await browser.newPage();
|
||||
if (!await enableJavascriptForUrl(url)) {
|
||||
if (!enableJavascriptForUrl(url)) {
|
||||
await page.setJavaScriptEnabled(false);
|
||||
}
|
||||
const ua = generateRandomUA();
|
||||
|
|
|
|||
Loading…
Reference in a new issue