Building a Telegram Bot ? to Automate Web Processes – Best Telegram

Building a Telegram Bot ? to Automate Web Processes

Using Python, Selenium and Telegram

Created by Katerina Limpitsouni
Created by Katerina Limpitsouni
  1. Copy the link of the article you want (E.g. https://towardsdatascience.com/an-introduction-to-json-c9acb464f43e).
  2. Go to Outline.com and paste it in the box and hit “Create Outline” (An “outline” is basically what Outline.com creates of your article — a simple, ease to read and nice to see version)
  3. Within a few seconds, Outline will redirect you to your “outline” with a customised link that you can share with anyone. Your highlights and annotations can be seen by anyone with the link.
Created by Katerina Limpitsouni
  • Telegram Python Wrapper
  • Logging (should be in Python by default)
  • Selenium Chrome WebDriver (For this post, we use Chrome on macOS, but you can choose any OS and browser as Selenium supports most of them).
  • Time (should be in Python by default)
Created by Katerina Limpitsouni
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',level=logging.INFO)
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
updater = Updater(token='TOKEN', use_context=True)
dispatcher = updater.dispatcher
def start(update, context):
context.bot.send_message(chat_id=update.message.chat_id, text="I'm a bot, please talk to me!")
dispatcher.add_handler(CommandHandler('start', start))
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def read(update, context):
dispatcher.add_handler(CommandHandler('read', read))
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome('**directory of chromedriver**')
browser.get('https://www.outline.com')
linkbar = browser.find_element_by_id('source')
linkbar.send_keys(context.args)
linkbar.send_keys(Keys.ENTER)
time.sleep(10)
context.bot.send_message(chat_id=update.message.chat_id, text=browser.current_url)
def main():   # Create updater and pass in Bot's API token.   updater = Updater(token='your_key_here', use_context=True)   # Get dispatcher to register handlers   dispatcher = updater.dispatcher   # answer commands   dispatcher.add_handler(CommandHandler('start', start))   dispatcher.add_handler(CommandHandler('read', read))   # start the bot   updater.start_polling()   # stop   updater.idle()if __name__ == '__main__':
main()

raivatshah/OutlineBot

A Telegram Bot ? to automate the process of obtaining Outline.com links – raivatshah/OutlineBot

github.com

python-telegram-bot/python-telegram-bot

We have made you a wrapper you can't refuse. Contribute to python-telegram-bot/python-telegram-bot development by…

github.com

Welcome to Python Telegram Bot's documentation! – Python Telegram Bot 11.1.0 documentation

Welcome to Python Telegram Bot's documentation!

– Python Telegram Bot 11.1.0 documentation
Welcome to Python Telegram Bot's documentation!python-telegram-bot.readthedocs.io

Ten articles before and after

Top Telegram Bots of 2017: 8 Innovating and Fun Chatbots – Best Telegram

“Why people in ‘Crypto’ space use Telegram is all beyond me” – Best Telegram

The Binance Telegram Raffle. Get a chance to win free BNB just by… – Best Telegram

AMA RECAP TERRACREDIT CRYPTO REVOLUTION TELEGRAM GROUP – Best Telegram

Telegram from Russia: Compliance and complicity in the Russian government’s attack on privacy – Best Telegram

How I spent $50K and 2 years building a meditation app and then pivoted to a telegram bot in 2 weeks with $0 cost – Best Telegram

KuCoin Telegram Listing Competition Clarification – Best Telegram

ついに日本語公式のTelegramチャットグループがオープンしました – Best Telegram

Dan’s June 1st Telegram AMA: Recap – Best Telegram

Nagricoin + Telegram Passport = easy KYC! – Best Telegram