mochart

Music online charts.


Keywords
music, online, chart, ranking, melon, mnet, naver, gaon, oricon, parser
License
MIT
Install
pip install mochart==0.1.1

Documentation

mochart

CircleCI

mochart(music on chart) is a simple webpage parser that aims to retrieve song rankings in JSON compatible data format.

Installation

A simple pip install:

pip install mochart

Example

Realtime ranks from Melon:

from mochart import melon
ranks = melon.realtime()
print(ranks)

At the time of this writing, the code would print:

[{
	"title": "SOLO",
	"artist": "μ œλ‹ˆ (JENNIE)",
	"album": "SOLO"
}, {
	"title": "λ΄„λ°”λžŒ",
	"artist": "Wanna One (μ›Œλ„ˆμ›)",
	"album": "1ΒΉΒΉ=1 (POWER OF DESTINY)"
}, {
	"title": "Tempo",
	"artist": "EXO",
	"album": "DON`T MESS UP MY TEMPO - The 5th Album"
}, {
	"title": "YES or YES",
	"artist": "TWICE (νŠΈμ™€μ΄μŠ€)",
	"album": "YES or YES"
}, {
	"title": "λ„ˆλ₯Ό λ§Œλ‚˜",
	"artist": "폴킴",
	"album": "λ„ˆλ₯Ό λ§Œλ‚˜"
}, {
	"title": "아름닡고도 μ•„ν”„κ΅¬λ‚˜",
	"artist": "λΉ„νˆ¬λΉ„",
	"album": "HOUR MOMENT"
}, {
	"title": "Gravity",
	"artist": "EXO",
	"album": "DON`T MESS UP MY TEMPO - The 5th Album"
}...]

feat. μ•„μ΄λŒμ „μŸ

API

All functions in a provider(e.g. Melon) will return Python List that contains music information in order of its ranking.

Generally, a rank contains title, aritst, and album in string format as seen above.

Not all providers support the these functions.

realtime

Return the most current ranks at the time of query.

trend

Return songs that are trending at the time of query.

day

Return ranks given day.

week

Return ranks given week.

month

Return ranks given month.

year

Return ranks given year.

Datetime

Given datetime object will be converted into a local datetime for the provider. For example A datetime given to melon.day(today), the argument today will be converted to Asia/Seoul timezone before the query.

Note that if incorrect time is given to any function, it could return either an empty array or ranks of the closest date.

Also, if no datetime object is provided as an argument, the current time will be used in the query.

Contribution

You are more than welcome to contribute a new chart and/or ideas on this project.