Using Github Actions, Python and Telegram to Get Ribeye Specials – Telegram Group

Telegram

Using Github Actions, Python and Telegram to Get Ribeye Specials

Solution

Building it — python

from bs4 import BeautifulSoup as bs
from decouple import config
import requests
import sys
import telepot
MY_ID = config("MY_ID")
API_KEY = config("API_KEY")
def getSpecials():
URL = "http://www.meatsbyjohnandwayne.com/weeklyspecials.html" response = requests.get(URL) html = response.content
soup = bs(html, "lxml") answer = (
soup.find("td")
.text.replace("\n", "")
.replace("\xa0", "")
.replace(
"(function(d, s, id) {\r var js, fjs = d.getElementsByTagName(s)[0];\r if (d.getElementById(id)) return;\r js = d.createElement(s); js.id = id;\r js.src = \"//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5\";\r fjs.parentNode.insertBefore(js, fjs);\r}(document, 'script', 'facebook-jssdk'));",
"",
)
) return answer
def send_telegram_message(msg): bot = telepot.Bot(API_KEY)
bot.getMe()
bot.sendMessage(MY_ID, msg)
if __name__ == "__main__":

# Get the specials
meats = getSpecials()

send_telegram_message(meats)
Specials for the WeekMONDAY-SATURDAY1/31/22-2/5/22USDA 
CHOICENEW YORK STRIPSTEAK$9.99/LB
TORTILLA CRUSTEDHOT PEPPER CHEESE STUFFED CHICKEN BREAST$6.99/LB
OUR OWNSMOKED HUNTERSRING SAUSAGE$3.99/LB

Building it — Github actions

name: meat_telegram# Controls when the action will run.
on:
# Action can be manually started
workflow_dispatch:
# job runs on Mon and Tues mornings
schedule:
- cron: '0 15 * * 1'
- cron: '0 13 * * 2'jobs: build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out this repository
uses: actions/checkout@v2 - name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8' - name: Install pipenv
run: pip install pipenv - name: Install deps
run: pipenv install # Run the Python script
- name: Run Python script
run: pipenv run python main.py
env:
API_KEY: ${{ secrets.API_KEY }}
MY_ID: ${{ secrets.MY_ID }}

Building it — Telegram

Wrap up

Appendix

main.py

from bs4 import BeautifulSoup as bs
from decouple import config
import requests
import sys
import telepot
MY_ID = config("MY_ID")
API_KEY = config("API_KEY")def getSpecials():
URL = "http://www.meatsbyjohnandwayne.com/weeklyspecials.html" response = requests.get(URL) html = response.content
soup = bs(html, "lxml") answer = (
soup.find("td")
.text.replace("\n", "")
.replace("\xa0", "")
.replace(
"(function(d, s, id) {\r var js, fjs = d.getElementsByTagName(s)[0];\r if (d.getElementById(id)) return;\r js = d.createElement(s); js.id = id;\r js.src = \"//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5\";\r fjs.parentNode.insertBefore(js, fjs);\r}(document, 'script', 'facebook-jssdk'));",
"",
)
) return answer
def send_telegram_message(msg): bot = telepot.Bot(API_KEY)
bot.getMe()
bot.sendMessage(MY_ID, msg)
if __name__ == "__main__": # Get the specials
meats = getSpecials() send_telegram_message(meats)

send_meat_via_telegram.yaml

name: meat_telegram# Controls when the action will run.
on:
# Action can be manually started
workflow_dispatch:
# job runs on Mon and Tues mornings
schedule:
- cron: '0 15 * * 1'
- cron: '0 13 * * 2'jobs: build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out this repository
uses: actions/checkout@v2 - name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install pipenv
run: pip install pipenv - name: Install deps
run: pipenv install # Run the Python script
- name: Run Python script
run: pipenv run python main.py
env:
API_KEY: ${{ secrets.API_KEY }}
MY_ID: ${{ secrets.MY_ID }}

Directory structure

.
├── .gitattributes
├── .github
│ └── workflows
│ └── send_meat_via_telegram.yml
├── main.py
├── Pipfile
├── Pipfile.lock
└── README.md

Ten articles before and after

The art of indexing +1PB data on Telegram – Telegram Group

Telegram in Business: How to Use the Messenger to Increase Sales – Telegram Group

Here Are The Top Crypto Signal Groups In 2022 – Telegram Group

Stop posting your emails on public forums! – Telegram Group

Manage Telegram’s free unlimited storage with a Windows app – Telegram Group

How to Install and Run the Crypto-Telegram Bot – Telegram Group

How Telegram Makes Money? Telegrams New Plan to Generate Cash – Telegram Group

How I made +25% in few hours with the help of trading bot! – Telegram Group

Monitoring Ethereum Wallets with Python & Telegram – Telegram Group

Crypto Bot Binance + Telegram. Write your own alert bot for any type… – Telegram Group

About Me

Pretium lorem primis senectus habitasse lectus donec ultricies tortor adipiscing fusce morbi volutpat pellentesque consectetur risus curae malesuada dignissim lacus convallis massa mauris.