Skip to content

Instantly share code, notes, and snippets.

@lowweihong
Created August 31, 2019 08:49
Show Gist options
  • Save lowweihong/68b94101e1ebdf204ba9cc0181e37474 to your computer and use it in GitHub Desktop.
Save lowweihong/68b94101e1ebdf204ba9cc0181e37474 to your computer and use it in GitHub Desktop.
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