Skip to content

Instantly share code, notes, and snippets.

@deguchi
Last active July 6, 2017 06:42
Show Gist options
  • Select an option

  • Save deguchi/38bcfeee526971c97f678a2c5d4a9111 to your computer and use it in GitHub Desktop.

Select an option

Save deguchi/38bcfeee526971c97f678a2c5d4a9111 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import re
import json
import requests
url = 'https://store.nintendo.co.jp/customize.html'
content = requests.get(url).text
if re.search(r'\bSOLD\s+OUT\b', content):
print('Nintendo Switch SOLD OUT.')
else:
requests.post('SET-YOUR_SLACK-WEBHOOK-URL', data = json.dumps({
'channel': u'発売',
'text': u"Hi, @deguchi. My Nintendo Store customization html has been changed.<%s>" % url, # 投稿するテキスト
'username': u'発売チェッカー', # 投稿のユーザー名
'icon_emoji': u':ghost:', # 投稿のプロフィール画像に入れる絵文字
'link_names': 1, # メンションを有効にする
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment