Skip to content

Commit d7eadc0

Browse files
committed
Issue #9 - Now using Zyte API - Extension can now read content from pages that require Javascript
1 parent 08b52eb commit d7eadc0

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

background.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -328,50 +328,50 @@ function handlePDFLink(pdfUrl, domain, sectionTitle, callback) {
328328

329329

330330

331-
function fetchPageHTML(url, domain, sectionTitle) {
332-
return new Promise((resolve, reject) => {
333-
fetch(url)
334-
.then(response => {
335-
if (!response.ok) {
336-
throw new Error('The URL you entered could not be found. Please check the URL and try again.');
337-
}
338-
return response.text();
339-
})
340-
.then(text => resolve(text))
341-
.catch(error => {
342-
handleSummaryError(domain, sectionTitle, error.toString());
343-
reject(error);
344-
});
345-
});
346-
}
347-
348-
349-
350331
// function fetchPageHTML(url, domain, sectionTitle) {
351332
// return new Promise((resolve, reject) => {
352-
// fetch('https://docdecoder.app/fetch_html', { // Replace with your Flask server URL
353-
// method: 'POST',
354-
// headers: {
355-
// 'Content-Type': 'application/json'
356-
// },
357-
// body: JSON.stringify({ url: url })
358-
// })
359-
// .then(response => {
360-
// if (!response.ok) {
361-
// throw new Error('Failed to fetch page HTML. Please check the URL and try again.');
362-
// }
363-
// return response.text();
364-
// })
365-
// .then(text => resolve(text))
366-
// .catch(error => {
367-
// handleSummaryError(domain, sectionTitle, error.toString());
368-
// reject(error);
369-
// });
333+
// fetch(url)
334+
// .then(response => {
335+
// if (!response.ok) {
336+
// throw new Error('The URL you entered could not be found. Please check the URL and try again.');
337+
// }
338+
// return response.text();
339+
// })
340+
// .then(text => resolve(text))
341+
// .catch(error => {
342+
// handleSummaryError(domain, sectionTitle, error.toString());
343+
// reject(error);
344+
// });
370345
// });
371346
// }
372347

373348

374349

350+
function fetchPageHTML(url, domain, sectionTitle) {
351+
return new Promise((resolve, reject) => {
352+
fetch('https://docdecoder.app/fetch_html', { // Replace with your Flask server URL
353+
method: 'POST',
354+
headers: {
355+
'Content-Type': 'application/json'
356+
},
357+
body: JSON.stringify({ url: url })
358+
})
359+
.then(response => {
360+
if (!response.ok) {
361+
throw new Error('Failed to fetch page HTML. Please check the URL and try again.');
362+
}
363+
return response.text();
364+
})
365+
.then(text => resolve(text))
366+
.catch(error => {
367+
handleSummaryError(domain, sectionTitle, error.toString());
368+
reject(error);
369+
});
370+
});
371+
}
372+
373+
374+
375375
function summarizeDocument(document, url, sectionTitle, pageURL) {
376376
let domain = url;
377377
logMessage(`Sending summary request for ${sectionTitle} on ${domain}`);

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 3,
33
"name": "DocDecoder - Summarize Web Policies With AI",
44
"description": "DocDecoder uses GPT-4 to generate clear, concise summaries of any site's legal policies for you to skim over before you accept them.",
5-
"version": "1.2.3",
5+
"version": "1.2.4",
66
"action": {
77
"default_popup": "popup.html",
88
"default_icon": {

0 commit comments

Comments
 (0)