lexi

i like breaking computers

  • it/its, #[deprecated] she/her
  • ./a.out

i like rust, nix, linux, infosec, webdev and i shitpost a lot. ctf player and so-called "security researcher". aroace, agender, nb, nd, disabled, &, ΘΔ :3 🏳️‍⚧️ 🟨⬜️🟪⬛️

picrew: #1322863


lexi
@lexi

test

that worked suprisingly well!


lexi
@lexi

hey bird app users. you should see this

and indeed, they do!


lexi
@lexi

okay so if you want to use this, install twit, get some twitter tokens and just run this node.js script somewhere:

let T = new (require('twit'))({
      consumer_key: 'xxx',
      consumer_secret: 'xxxxxx',
      access_token: '000000-xxx',
      access_token_secret: 'xxx'
})

let latest = 999999999999

let main = async () => {
        console.log('Fetching page...')
        let res = await fetch('https://cohost.org/lexi')
        console.log('Fetched, parsing...')
        let text = await res.text()
        let start = '<script type="application/json" id="trpc-dehydrated-state">'
        let water = text.split('\n').find(e=>e.startsWith(start)).replace(start, '').slice(0, -("</script>".length))
        let hydrated = JSON.parse(water)
        let posts = hydrated.queries[5].state.data.posts
        console.log(`Parsed, found ${posts.length} chosts, comparing...`)
        let new_posts = posts.filter(e=>e.postId > latest).map(e=>e.singlePostPageUrl)
        console.log(`Found ${new_posts.length} new posts: [${new_posts.join(' | ')}]`)
        latest = posts[0].postId
        new_posts.map(e=>T.post('statuses/update', {status: `i just posted on cohost! ${e}`}))
}

setInterval(main, 60*1000)

You must log in to comment.