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)
regarding this: DO NOT USE IT it has a bug where it finds "new" posts that arent new lol
EDIT: the issue is triaged, the order was in fact not chronological! i fixed the code


