Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Last active September 29, 2020 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akkiesoft/6884d93714a63ff7fda7f07a7e8b9a2d to your computer and use it in GitHub Desktop.
Save Akkiesoft/6884d93714a63ff7fda7f07a7e8b9a2d to your computer and use it in GitHub Desktop.
また鉄板でジューシーに焼いてる!
# -*- 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/rss.xml"
f = feedparser.parse(feed)
for entry in f.entries:
if (u"発売" in entry.title) or (u"販売" in entry.title) or (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()
response = requests.get(url)
response.encoding = response.apparent_encoding
html = response.text
mstdn = Mastodon(
client_id = "",
client_secret = "",
access_token = "",
api_base_url = "https://social.mikutter.hachune.net/"
)
don_update(u"【📣松屋の新商品📣】 " + f_title + " " + url)
if "鉄板" in html:
if "ジューシー" 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