Created
March 2, 2017 12:04
-
-
Save turanegaku/17e36efd47b0e0b026e43c9a4c2f29e0 to your computer and use it in GitHub Desktop.
グランデ警察
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from bs4 import BeautifulSoup | |
| import os | |
| import re | |
| import requests | |
| import time | |
| def get_multi(): | |
| # r = requests.get('http://gbf-wiki.com/index.php?コメント/通常マルチバトル救援募集板') | |
| r = requests.get('http://gbf-wiki.com/index.php?%A5%B3%A5%E1%A5%F3%A5%C8%2F%C4%CC%BE%EF%A5%DE%A5%EB%A5%C1%A5%D0%A5%C8%A5%EB%B5%DF%B1%E7%CA%E7%BD%B8%C8%C4') | |
| soup = BeautifulSoup(r.text, 'html.parser') | |
| b = re.compile('[0-9a-zA-Z]{8}') | |
| return set([b.search(li.text).group() for li in soup.select('#body .list1 li') if 'グランデ' in li.text and b.search(li.text)]) | |
| if __name__ == '__main__': | |
| db = get_multi() | |
| while True: | |
| time.sleep(5) | |
| now = get_multi() | |
| up = now - db | |
| if up: | |
| print(up) | |
| i = list(up)[0] | |
| os.system('[[ `terminal-notifier -message %s -closeLabel No -actions Yes` -eq "Yes" ]] && echo %s | pbcopy' % (i, i)) | |
| db.update(now) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment