async function do_everything()

in poster.js [96:166]


async function do_everything(feeds){
  let list_of_stories = []
  let already_posted = []
  let cursor = "";

  // ### Login and validate  
  const agent = new BskyAgent({ service: "https://bsky.social" });

  await agent.login({
    identifier: accounty,
    password: passy,
  });

  // ### Grab the already posted stories 

  await agent.getAuthorFeed({
      actor: accounty,
      limit: 5,
      cursor: cursor,
    }).then(response => 
      {
        cursor = response.cursor

        let latest = response.data.feed.map(d => d.post.indexedAt)

        console.log(new Date(Math.max.apply(null, latest.map(function(e) {
          return new Date(e);
        }))))

        console.log(new Date())

        for (const feed of response.data.feed) {
          already_posted.push(feed.post.record.embed.external.uri)
        }
      }
    // ).then(() => console.log("already_posted: ", already_posted)
    )

  // ### This first grabs the stories 

    Promise.all(feeds.map(url => parser.parseURL(url)
      .then(response => 
        {
        for (const item of response.items)
        {
          // let inter_description = null;
          // const description_ = dom('head > meta[property="og:description"]');
          // if (description_) {
          //   inter_description = description_.attr("content");
          // }
          // ### Check to see if it has already been posted 
          if (!already_posted.includes(item.link + '?CMP=aus_bsky')){
            list_of_stories.push({
              title: item.title,
              link: item.link,
              description: item.contentSnippet
            })
          }
        }
        })
        ))
        
        .then(() => {

          console.log(list_of_stories.length)

          final(agent, list_of_stories)

        })

}