Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Code generator for Phantombuster deployment #43

Open
fmaume opened this issue May 29, 2021 · 0 comments
Open

Code generator for Phantombuster deployment #43

fmaume opened this issue May 29, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@fmaume
Copy link

fmaume commented May 29, 2021

Is your feature request related to a problem? Please describe.
Allow to deploy script on Phantombuster to use Phantombuster infra and scheduling option

Describe the solution you'd like
From puppeter code:
Add the following header:

// Phantombuster configuration {
"phantombuster package: 5"
"phantombuster command: nodejs"
"phantombuster flags: save-folder"
// }
const Buster = require("phantombuster")
const buster = new Buster()

Comment those lines:

//const prettier = require("prettier");
//const prompts = require("prompts");

Comment those lines:

      /*
      console.log({ variable0: formattedVariable0 });
      if (!promptContinue) {
        const response = await prompts({
          type: "confirm",
          name: "value",
          message: "Continue?",
          initial: true,
        });
        if (!response.value) {
          process.exit();
        }
        promptContinue = true;
      }
      data.push({ variable0: formattedVariable0 });
      bar.tick();*/
      }
      
    /*
    fs.writeFile(
      outputFilename || `./${new Date()}.json`,
      prettier.format(JSON.stringify(data), {
        parser: "json",
      }),
      (err) => {
        if (err) return console.log(err);
      }
    );
    */

Add the following lines to save the result:

let csvContent =  data.join("\r\n");
const saveAs = "texts/sample.csv"
const mime = "text/plain"
const url2 = await buster.saveText(csvContent, saveAs, mime)

replace all catch by catch (e).

@fmaume fmaume added the enhancement New feature or request label May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants