Created
August 31, 2019 08:49
-
-
Save lowweihong/68b94101e1ebdf204ba9cc0181e37474 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
import lxml.html | |
dom = lxml.html.fromstring(r.text) | |
for node_link in dom.cssselect('tr > td:nth-child(2) > a:nth-child(3)'): | |
url = node_link.get('href') # OR node_link.attrib['href'] | |
# check whether the url is downloadable | |
if is_downloadable(url): | |
wget.download(url, './data/' + url.split('&file=')[-1].split('&format')[0] + '.mid') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment