Skip to content

Instantly share code, notes, and snippets.

View lanfon72's full-sized avatar
💭
Nothing new

Lanfon lanfon72

💭
Nothing new
View GitHub Profile
@lanfon72
lanfon72 / femh.py
Last active August 29, 2015 14:04
parse femh live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://www.femh.org.tw/research/news_op.aspx')
update_time =re.findall(u'日期:(.*)</span>',html.text)
update_time.append( datetime.now().strftime('%p') )
update_time = ' '.join(update_time)
@lanfon72
lanfon72 / pohai.py
Last active August 29, 2015 14:04
parse pohai live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://www.pohai.org.tw/pohai/bedqty_er/bedqty_er.php')
html.encoding='utf8'
update_time = re.findall(u'日期:(.*)</td>',html.text)
@lanfon72
lanfon72 / cgh.py
Last active August 29, 2015 14:04
parse cgh live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://med.cgh.org.tw/unit/branch/Pharmacy/ebl/RealTimeInfoHQ.html')
html.encoding='big5'
update_time = re.findall(u'時間:(.*)</p>',html.text)
pending = re.findall(u':</td *>(.+?)</td>',html.text)
@lanfon72
lanfon72 / wanfangh.py
Last active August 29, 2015 14:04
parse wanfangh live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://www.wanfang.gov.tw/p11_information.aspx')
update_time = re.findall(u"日期:(.+?)</div",html.text)[0]
pending = re.findall(u"\'>(.+?)</div",html.text)[:-1]
# prase like ["<div class='p11_con'><div class='p11_icon05'>否", '1', '0', '16', '1']
@lanfon72
lanfon72 / tp_vgh.py
Last active August 29, 2015 14:04
parse vghtpe live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://www6.vghtpe.gov.tw/ERREALIFO/ERREALIFO.jsp')
html.encoding='big5'
pending = re.findall(u'">?(\w+)</font>',html.text)
full_reported = re.findall(u'體">?(.?)</font>',html.text)[0]
@lanfon72
lanfon72 / shh.py
Last active August 29, 2015 14:04
parse ssh live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://eng.shh.org.tw/ER_WEB/ER_WEB/Default.aspx')
html.encoding='utf8'
pending = re.findall(u'">(.*)</span>',html.text)
# prase like ['<b><font color="Red">未滿載</font></b>', '1', '0', '22', '0', '06:33:10']
@lanfon72
lanfon72 / hltch.py
Last active August 29, 2015 14:04
parse hltch live ER status board
#!/usr/bin/env ptyhon
#coding:UTF-8
import requests, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://hlm.tzuchi.com.tw/html/HLinfo/Hlinfo.php')
pending = json.loads(html.text)[0]
# keys: ['m', 'WaitToPushBed', 'yy', 's', 'BedFull', 'WaitToAdm', 'WaitToDiagnosis', 'dd', 'mm', 'WaitToICU', 'h']
full_reported = True if u'是' in pending['BedFull'] else False
@lanfon72
lanfon72 / ndmctsgh.py
Last active August 29, 2015 14:04
parse ndmctsgh live ER status boaard
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
os.environ['TZ'] = 'ROC'
html = requests.get('http://www1.ndmctsgh.edu.tw/ErOnlineNews/ErOnLineData.aspx')
pending = re.findall(u'd">(.+)</fon',html.text)
# prase like ['否', '3', '0', '9', '0']
values = [ int(ele) for ele in pending[1:] ]
@lanfon72
lanfon72 / tsmh.py
Last active August 29, 2015 14:04
parse tsmh live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://www.tsmh.org.tw/~webapp/b/web_dg/er_status/er_show_db.php')
html.encoding='big5'
pending = re.findall(u': (.*?) 人',html.text)
# parse like ['1', '0', '4', '0']
@lanfon72
lanfon72 / mmh-ts.py
Last active March 3, 2017 06:25
prase mmh(TamShui) live ER status board
#!/usr/bin/env python
#coding:UTF-8
import requests, re, json, os
from datetime import datetime
os.environ['TZ'] = 'ROC'
headers = {"Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "User-Agent": " Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36"}
data = {'RadioButtonList1': '2', '__EVENTARGUMENT': '', '__EVENTTARGET': 'RadioButtonList1$1', '__EVENTVALIDATION': '/wEWBQKuhbKKAwL444i9AQL544i9AQL3jKLTDQKM54rGBiyOzv44KJOw6BT65+syY0+hyJGU', '__LASTFOCUS': '', '__VIEWSTATE': '/wEPDwUKLTg4MTI3NDI5MQ9kFgICAw9kFgQCBQ8QZGQWAWZkAgcPPCsADQEADxYEHgtfIURhdGFCb3VuZGceC18hSXRlbUNvdW50AgZkFgJmD2QWDgIBD2QWBGYPDxYCHgRUZXh0BQ/oqIrmga/mmYLplpPvvJpkZAIBDw8WAh8CBRUyMDE3LzMvMyDkuIvljYggMDI6MDlkZAICD2QWBGYPDxYCHwIFIeW3suWQkTExOemAmuWgsea7v+W6iu+8iOi8ie+8ie+8mmRkAgEPDxYCHwIFA+WQpmRkAgMPZBYEZg8PFgIfAgUV562J5b6F55yL6Ki65Lq65pW477yaZGQCAQ8PFgIfAgUBNWRkAgQPZBYEZg8PFgIfAgUV562J5b6F5o6o5bqK5Lq65pW477yaZGQCAQ8PFgIfAgUBMGRkAgUPZBYEZg8PFgIfAgUV562J