-
-
Save timkofu/df0642936123f9ae7178 to your computer and use it in GitHub Desktop.
This file contains 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 requests | |
from bs4 import BeautifulSoup | |
from num2words import num2words | |
import time | |
import subprocess | |
import re | |
import random | |
maxlen = 31 | |
while maxlen: | |
mp3_link = [x['href'] for x in BeautifulSoup(requests.get('http://musicforprogramming.net/?c{}'.format(num2words(maxlen).replace('-',''))).text).find_all('a') if re.search('\.mp3', x['href'])][0] | |
for output in iter(subprocess.Popen(['/usr/bin/axel', mp3_link], stdout=subprocess.PIPE).stdout.readline, b""): | |
print(output) | |
maxlen -= 1 | |
time.sleep(random.randint(30,67)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment