Instantly share code, notes, and snippets.

Embed
What would you like to do?
また鉄板でジューシーに焼いてる!
# -*- coding: utf-8 -*-
import feedparser
import requests
from mastodon import Mastodon
def don_update(str):
mstdn.status_post(
status = str + " #matsuya_juicy_detector",
visibility = "unlisted"
)
feed = "https://www.matsuyafoods.co.jp/whatsnew/whatsnew-rss/"
f = feedparser.parse(feed)
for entry in f.entries:
if u"発売" in entry.title:
f_url = entry.link
f_title = entry.title
break
fp = open('matsuya-item.txt', 'r')
url = fp.read()
fp.close()
if url == f_url:
exit()
url = f_url
fp = open('matsuya-item.txt', 'w')
fp.write(url)
fp.close()
html = requests.get(url).text
mstdn = Mastodon(
client_id = "",
client_secret = "",
access_token = "",
api_base_url = "https://social.mikutter.hachune.net/"
)
don_update(u"【📣松屋の新商品📣】 " + f_title + " " + url)
if u"鉄板" in html:
if u"ジューシー" in html:
don_update("!!!また鉄板でジューシーに焼いてる!!!")
else:
don_update("!!!鉄板なのにジューシーに焼いてない!!!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment