{"flow":{"id":43,"summary":"Gets the top 3 HackerNews stories and send them on Slack","versions":[173],"created_by":"henri186","created_at":"2023-05-26T11:51:26.978Z","votes":1,"approved":false,"apps":["slack"],"value":{"modules":[{"id":"b","value":{"lock":"beautifulsoup4==4.12.2\nbs4==0.0.1\ncertifi==2023.5.7\ncharset-normalizer==3.1.0\nhtml5lib==1.1\nidna==3.4\nlxml==4.9.2\nrequests==2.31.0\nsix==1.16.0\nsoupsieve==2.4.1\nurllib3==2.0.2\nwebencodings==0.5.1","type":"rawscript","content":"from bs4 import BeautifulSoup\nimport requests\nfrom lxml.html import html5parser\nimport html5lib\n\ndef main(infos: list):\n    url = \"https://news.ycombinator.com/news\"\n    r = requests.get(url)\n    data = r.text\n    soup = BeautifulSoup(data, \"lxml\")\n    titles = soup.find_all(\"td\", class_=\"title\")\n    links = soup.find_all(\"a\")\n\n    res = []\n    for title in titles[:6]:\n        h = html5parser.fromstring(str(title)).getchildren()\n        if h:\n            title_text = h[0].text\n            link = h[0].get('href')\n            res.append((title_text, link))\n\n    return res","language":"python3","input_transforms":{"infos":{"type":"static","value":[]}}},"summary":"Gets 3 best stories"},{"id":"a","value":{"path":"hub/849/slack/send_message_to_channel","type":"script","input_transforms":{"text":{"expr":"`Here are the 3 most popular stories: \\n` + results.b[0] + `\\n`+ results.b[1] + `\\n` + results.b[2]","type":"javascript"},"slack":{"expr":"flow_input[\"Slack Account\"]","type":"javascript"},"channel":{"expr":"flow_input.Channel","type":"javascript"}}},"summary":"Send Message to Channel (slack)"}]},"schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":[],"properties":{"Channel":{"type":"string","format":"","default":"","description":""},"Slack Account":{"type":"object","format":"resource-slack","default":"","description":""}}},"description":"","recording":null,"vcreated_at":"2023-05-26T11:51:26.978Z","vcreated_by":"henri186","comments":[]}}