source: misc/sublimefm_playlist.py@ 422

Last change on this file since 422 was 403, checked in by Rick van der Zwet, 6 years ago

Add sublimefm playlist generator for use of auto-imports

  • Property svn:executable set to *
File size: 1.6 KB
Line 
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
11from bs4 import BeautifulSoup
12
13import argparse
14import glob
15import json
16import re
17import requests
18import time
19
20parser = argparse.ArgumentParser()
21parser.add_argument('date', type=str, default=time.strftime('%Y-%m-%d'), nargs='?')
22args = parser.parse_args()
23
24
25
26r = requests.get('https://sublimefm.nl/muziek?date=' + args.date)
27soup = BeautifulSoup(r.text, 'html.parser')
28#soup = BeautifulSoup(open('sublimefm.html','r'), 'html.parser')
29
30
31for 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
40from bs4 import BeautifulSoup
41
42import argparse
43import glob
44import json
45import re
46import requests
47import time
48
49parser = argparse.ArgumentParser()
50parser.add_argument('date', type=str, default=time.strftime('%Y-%m-%d'), nargs='?')
51args = parser.parse_args()
52
53
54
55r = requests.get('https://sublimefm.nl/muziek?date=' + args.date)
56soup = BeautifulSoup(r.text, 'html.parser')
57#soup = BeautifulSoup(open('sublimefm.html','r'), 'html.parser')
58
59
60for 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])
Note: See TracBrowser for help on using the repository browser.