summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--download_script.py3
-rw-r--r--server.js10
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
diff --git a/server.js b/server.js
index c8dd2e4..5727d34 100644
--- a/server.js
+++ b/server.js
@@ -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 => {