- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¥»©«³Ì«á¥Ñ c_c_lai ©ó 2017-2-9 19:59 ½s¿è
¦^´_ 11# VBALearner
½Ð±Ð¬°¦ó·|µL select ÄݩʡH
§Ú¿é¤J¤º®e¬O§_¦³»~¡H- import requests
- import time
- from bs4 import BeautifulSoup
- ¥D´£³æ¸¹½X=['160-69306532','608-10318674']
- with requests.session() as r:
- res = r.get('https://accs.tradevan.com.tw/accsw-bin/APACCS/userLoginAction.do?userid=GUEST&password=GUEST')
- for code in ¥D´£³æ¸¹½X:
- print('¥D´£³æ¸¹½X¡G',code, '\n')
- payload = {'mawb_no':code,'¬d¸ß':'¬d¸ß'}
- res = r.post("https://accs.tradevan.com.tw/accsw-bin/APACCS/clmMergeQueryAction.do", data=payload)
- res.encoding = "big-5"
- html = BeautifulSoup(res.text,"html.parser")
- for tr in html.body.select('table')[4].select('tr')[1:]: #½Ð¸Ô¾\w3school¸Ì¦³ÃöHTMLªºTable¼ÐÅÒª¾ÃÑ¡A´N¯àª¾¹D³o¸Ì¦b°µÔ£
- data = [] #«Ø¥ß°}¦C
- for td in tr.select('td'):
- data.append(td.text.strip())
- if td == tr.select('td')[len(tr.select('td'))-1]: #³o¸Ì¦³¤U¤@ÓPOST©Ò»Ýªº¸ê°T (payload)¡A³z¹LÆ[¹îºô¶ì©l½X±oª¾
- print('²Ä¤G¦¸POSTªº¸ê®Æ¡G',td,'\n')
- print('ºKn¸ê°T¡G',data, '\n') #²Ä¤@¦¸¬d¸ß±o¨ìªººKn¸ê®Æ
½Æ»s¥N½X |
|