[403] | 1 | #!/usr/bin/env python3
|
---|
| 2 | #
|
---|
| 3 | # Quirk to generate sublimefm playlist text file for importing in
|
---|
| 4 | # Spotify (using Soundiiz for example).
|
---|
| 5 | #
|
---|
| 6 | # Rick van der Zwet <info@rickvanderzwet.nl>
|
---|
| 7 | #
|
---|
| 8 | # License: https://rickvanderzwet.nl/LICENSE (BSD-2-Clause)
|
---|
| 9 | #
|
---|
| 10 |
|
---|
| 11 | from bs4 import BeautifulSoup
|
---|
| 12 |
|
---|
| 13 | import argparse
|
---|
| 14 | import glob
|
---|
| 15 | import json
|
---|
| 16 | import re
|
---|
| 17 | import requests
|
---|
| 18 | import time
|
---|
| 19 |
|
---|
| 20 | parser = argparse.ArgumentParser()
|
---|
| 21 | parser.add_argument('date', type=str, default=time.strftime('%Y-%m-%d'), nargs='?')
|
---|
| 22 | args = parser.parse_args()
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | r = requests.get('https://sublimefm.nl/muziek?date=' + args.date)
|
---|
| 27 | soup = BeautifulSoup(r.text, 'html.parser')
|
---|
| 28 | #soup = BeautifulSoup(open('sublimefm.html','r'), 'html.parser')
|
---|
| 29 |
|
---|
| 30 |
|
---|
| 31 | for artist in soup.find_all('span', class_='artist'):
|
---|
| 32 | title = artist.parent.find(class_='title')
|
---|
| 33 | print("%s - %s" %(artist.text, title.text))
|
---|
| 34 |
|
---|
| 35 | #href = link.get('href')
|
---|
| 36 | #if 'open.spotify.com/search/results/' in href:
|
---|
| 37 | # print(href.split('/')[-1])
|
---|
| 38 | #
|
---|
| 39 |
|
---|
| 40 | from bs4 import BeautifulSoup
|
---|
| 41 |
|
---|
| 42 | import argparse
|
---|
| 43 | import glob
|
---|
| 44 | import json
|
---|
| 45 | import re
|
---|
| 46 | import requests
|
---|
| 47 | import time
|
---|
| 48 |
|
---|
| 49 | parser = argparse.ArgumentParser()
|
---|
| 50 | parser.add_argument('date', type=str, default=time.strftime('%Y-%m-%d'), nargs='?')
|
---|
| 51 | args = parser.parse_args()
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | r = requests.get('https://sublimefm.nl/muziek?date=' + args.date)
|
---|
| 56 | soup = BeautifulSoup(r.text, 'html.parser')
|
---|
| 57 | #soup = BeautifulSoup(open('sublimefm.html','r'), 'html.parser')
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | for artist in soup.find_all('span', class_='artist'):
|
---|
| 61 | title = artist.parent.find(class_='title')
|
---|
| 62 | print("%s - %s" %(artist.text, title.text))
|
---|
| 63 |
|
---|
| 64 | #href = link.get('href')
|
---|
| 65 | #if 'open.spotify.com/search/results/' in href:
|
---|
| 66 | # print(href.split('/')[-1])
|
---|