Comments (4)
Hey there
You can just get the JSON data from Reddit: http://reddit.com/r/listentothis.json
See the Reddit API for details: https://www.reddit.com/dev/api/
To know if a link is playable, I do the following check: https://github.com/Illyism/musicplayer/blob/master/src/modules/playlist/util/isPlayable.ts
from redditmusicplayer.
Ok... So you don't extract the artist / tile out of the reddit posts ? I need a clean way to get them (no genre/year/text...)
from redditmusicplayer.
@gordielachance No, I just show the Reddit title. Let me know if you find a solution! I'd love to see it too.
from redditmusicplayer.
well, I had worked on some piece of code but of course, it's not perfect.
The goal is to extract the track artist and track name out of the node title.
artist regex pattern:
(?:(?:.*), +by +(.*))|(?:(.*)(?: +[-|–|—]+ +)(?:.*))
title regex pattern:
(?:(.*), +by +(?:.*))|(?:(?:.*)(?: +[-|–|—]+ +)(.*))
then I try to clean those strings the best I can (here in Ruby) :
def clean_string(str)
#remove quotation marks
ignore_wrappers = ['"','\'']
ignore_wrappers.each do |wrapper|
str.delete_prefix(wrapper).delete_suffix(wrapper)
end
#remove some specific strings
ignore_words = [
'(Audio)',
'(Official)',
'(Official Video)',
'(Official Audio)',
'(Official Videoclip)',
'(Clip officiel)',
'(Lyric Video)',
'(Official Music Video)',
'(HD)',
'(Music Video)',
'(High Quality)',
' HD',
' HQ',
]
ignore_words.each do |word|
str.gsub! word, ''
end
#remove some regexes
ignore_regexes = [
'\[.*\]', #eg [Hip-Hop]
'\(\d{4}\)', #dates - eg. (1968)
'\d{4} ?$', #dates (end of string) eg. 2005
'[-|–|—] *$' #dash (end of string)
]
ignore_regexes.each do |regex|
pattern = Regexp.new(regex)
str = str.gsub(pattern, '')
end
str.strip
end
Of course, this is completely arbitrary. But it sometimes work quite well.
from redditmusicplayer.
Related Issues (20)
- Website not loading any songs
- Feature Request - FIlter a sub by flair / category
- question: any interest in a standalone desktop app? HOT 1
- Stops playing while source is switched on unfocused tab
- multi-reddit support?
- soundcloud sound is always lower than played in the sourndcloud website HOT 7
- Support "next" pages
- Add these subreddits HOT 1
- Action required: Greenkeeper could not be activated 🚨
- Propose Logo/Icon HOT 2
- CONTRIBUTING.md missing
- Skip track that have votes below a threshold?
- Spotify support
- Soundcloud doesn't play HOT 1
- Previous/next track button icon HOT 2
- "Load More" not working
- Such a great project! HOT 1
- Music player not loading correctly on mobile
- Youtube Music links unplayable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redditmusicplayer.