This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MAX_CONCURRENT_TASKS = 5; | |
async function fetchStories() { | |
const response = await fetch( | |
"http://localhost:8000/get-where-no-story-content" | |
); | |
return response.json(); | |
} | |
async function updateStoryContent(_id, content) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let currentPage = 1; // Initialize the current page number to 1 | |
const lastPage = 5933; // Define the last page number to scrape, which is 5933 | |
// Listen for messages from other parts of the Chrome extension (e.g., content scripts) | |
chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { | |
if (message.stories) { // Check if the message contains a 'stories' property (the scraped data) | |
try { | |
// Send the scraped data to an API endpoint on the local server | |
const response = await fetch("http://localhost:8000/api/stories", { | |
method: "POST", // Use the POST method to send data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const mongoose = require("mongoose"); | |
const cors = require("cors"); | |
const app = express(); | |
const htmlToText = require("html-to-text"); | |
app.use(cors()); | |
app.use(express.json({ limit: "50mb" })); | |
mongoose.connect("mongodb://localhost:27017/web-scraper", { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function does the following | |
// 1. fetches the PDF resume from the url provided | |
// 2. creates a file object with the resume data | |
// 3. triggers the change event on the file input element | |
// 4. the file input element gets the file object | |
// 5. the file object is uploaded to the website | |
async function handleResumeInput(remoteResumeURL) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
const baseUrlMainServer = | |
process.env.ENV === "PROD" | |
? "https://api.project28.in" | |
: process.env.ENV === "QA" | |
? "https://qa.project28.in" | |
: (process.env.ENV = "DEV" | |
? "https://backend-staging.project28.in" | |
: "http://localhost:5000"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
const baseUrlMainServer = | |
process.env.ENV === "PROD" | |
? "https://api.project28.in" | |
: process.env.ENV === "QA" | |
? "https://qa.project28.in" | |
: (process.env.ENV = "DEV" | |
? "https://backend-staging.project28.in" | |
: "http://localhost:5000"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get("/sileo-depiction-revalidate/:package", async (req, res) => { | |
const dep_package = req.params.package; // package name | |
try { | |
const redisDepKey = `${dep_package}:depiction`; // redis key | |
return client.del(redisDepKey, async (err, success) => { // check if cached | |
if (success == 1) { // if success | |
res.status(200).send({ // send success acknowledgement | |
httpStatus: 200, | |
success: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get("/sileo-depiction/:package", async (req, res) => { | |
const dep_package = req.params.package; // package name | |
try { | |
const redisDepKey = `${dep_package}:depiction`; // redis key | |
return client.get(redisDepKey, async (err, cachedData) => { // check if cached | |
if (cachedData) { // if cached | |
const parsedData = JSON.parse(depiction); // parse cached data | |
res.status(200).send({ // send cached data | |
httpStatus: 200, |