frankcollins3 / PHPokedex

react concepts
0 stars 0 forks source link

{puppeteer: how to scan local machine db data} [7:46pm] #31

Open frankcollins3 opened 1 year ago

frankcollins3 commented 1 year ago
    anothertest: {
      // type: new GraphQLList(TestType),
      type: GraphQLString,
      description: 'test again',
      resolve: async() => {
        const browser = await puppeteer.launch();
        const page = await browser.newPage();
        await page.goto('https://www.google.com');
        **await page.screenshot({ path: 'google.png' });
        await browser.close();**
        return "guys im back"
        // setTimeout(() => {
        //   return "now im back"
        // }, 2000)
        // return [
        //   {name: "hey"},
        //   {name: "yeah"},
        //   {name: "no way"}
        // ]
      }
    },

Screen Shot 2023-05-09 at 7 35 21 PM

graphQL endpoints: invoke puppeteer functionality.

with puppeteer also being a web scraper, I wonder how to go about scraping local machine data.

first proposed approach: await page.goto(https://localhost:5000/main)

I haven't done so myself but apparently the utility can write-to forms, so there should be a way it can read-from UI.

If the pokemon/data were to be spanned across a div I would guess there is some way to make puppeteer scan and log strings

[7:51pm]

frankcollins3 commented 1 year ago

another proposed approach:

page.goto(https://www.pokemon.com/us/pokedex/)

1) see about puppeteer exploring for pokemon data. 2) retrieve relevant pokemon.name strings 3) conditional logic to check pokeapi.co API to check for existence of name

save the name to the database preferably reach out to the user via [ email | SMS ] to confirm if they want that data added to the database

[7:59pm]