diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-06-28 09:25:00 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-06-28 09:25:00 +0530 |
commit | af92d9f12534021ccb35e0328daec8fdc72c0ba2 (patch) | |
tree | 5eeb6ee3a8277664f94885de7b35c9d2ce1b09e7 | |
parent | b06cf01e232e797abceabba08aec2c0752db95ad (diff) | |
download | insta-local-af92d9f12534021ccb35e0328daec8fdc72c0ba2.tar.gz insta-local-af92d9f12534021ccb35e0328daec8fdc72c0ba2.tar.bz2 insta-local-af92d9f12534021ccb35e0328daec8fdc72c0ba2.zip |
removed the date and fixed content not loading issue
-rw-r--r-- | download_script.py | 3 | ||||
-rw-r--r-- | server.js | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/download_script.py b/download_script.py index be29fcc..a9d07c4 100644 --- a/download_script.py +++ b/download_script.py @@ -5,7 +5,7 @@ import os L = instaloader.Instaloader() L.login('xtester2', 'teTeD7QojvhOdvEGa50u6FFJo') PROFILES = ["aao.remote.ho.jaye"] -BASE_DIR = "/home/genos/imp/work/project/insta/downloads/2024-06-27" +BASE_DIR = "/home/genos/imp/work/project/insta/downloads" os.makedirs(BASE_DIR, exist_ok=True) @@ -22,3 +22,4 @@ def download_posts(profile): for profile in PROFILES: download_posts(profile) +
\ No newline at end of file @@ -23,8 +23,6 @@ const escapedUsername = escapePythonString(credentials.username); const escapedPassword = escapePythonString(credentials.password); const baseDir = path.join(__dirname, 'downloads'); -const dateStr = new Date().toISOString().split('T')[0]; -const dateDir = path.join(baseDir, dateStr); function downloadContent() { const influencers = JSON.parse(fs.readFileSync(path.join(__dirname, 'influencers.json'), 'utf8')).profiles; @@ -36,7 +34,7 @@ import os L = instaloader.Instaloader() L.login('${escapedUsername}', '${escapedPassword}') PROFILES = ${JSON.stringify(influencers)} -BASE_DIR = "${dateDir.replace(/\\/g, '/')}" +BASE_DIR = "${baseDir.replace(/\\/g, '/')}" os.makedirs(BASE_DIR, exist_ok=True) @@ -53,7 +51,7 @@ def download_posts(profile): for profile in PROFILES: download_posts(profile) -`; + `; const scriptPath = path.join(__dirname, 'download_script.py'); fs.writeFileSync(scriptPath, script); @@ -77,13 +75,13 @@ downloadContent(); // Endpoint to list downloaded files app.get('/downloads', (req, res) => { - fs.readdir(dateDir, (err, profiles) => { + fs.readdir(baseDir, (err, profiles) => { if (err) { return res.status(500).json({ error: err.message }); } const allowedExtensions = ['.mp4', '.jpg', '.jpeg']; const fileList = profiles.flatMap(profileDir => { - const profilePath = path.join(dateDir, profileDir); + const profilePath = path.join(baseDir, profileDir); return fs.readdirSync(profilePath) .filter(file => allowedExtensions.includes(path.extname(file).toLowerCase())) .map(file => { |