Skip to content

Instantly share code, notes, and snippets.

@mlouielu
Created July 14, 2018 08:41
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 mlouielu/78db4fa725990c802055bc0e7307e0a2 to your computer and use it in GitHub Desktop.
Save mlouielu/78db4fa725990c802055bc0e7307e0a2 to your computer and use it in GitHub Desktop.
import requests
from lxml import etree
r = requests.post('http://mops.twse.com.tw/mops/web/ajax_t93sc01_1', {'encodeURIComponent': 1, 'step': 1, 'firstin': 1, 'off': 1, 'TYPEK': 'sii'})
r.encoding = 'utf-8'
root = etree.HTML(r.text)
for r in root.xpath('//tr')[2:]:
print(list(r.itertext()))
@mlouielu
Copy link
Author

import requests
r = requests.post('http://mops.twse.com.tw/mops/web/ajax_t93sc01_1', {'encodeURIComponent': 1, 'step': 1, 'firstin': 1, 'off': 1, 'TYPEK': 'sii'})
r.encoding = 'utf-8'
print(r.text[:1000])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment