Latest 0.1.4
Homepage https://github.com/Fitzafful/BillboardSwiftLibrary
License MIT
Platforms ios 9.0, osx 10.10
Dependencies SwiftSoup
Authors

CI Status
Version
License
Platform

Basic Usage

To download a Billboard chart, we use the BillboardManager constructor.

Let’s fetch the current Hot 100 chart and for a particular date.

Dont forget to set Allow Arbitrary Loads under App Transport Security Settings in your info.plist to YES

import BillboardSwiftLibrary

let manager = BillboardManager()
manager.getChart(chartType: ChartType.hot100) { (entries, error) in
    if error != nil{
        print(error!.localizedDescription)
        return
    }

    print(entries!) //Array of ChartEntry
}

//FOR A PARTICULAR DATE (always remember date is in the form YYYY-MM-DD)
manager.getChart(chartType: ChartType.hot100, date: "2018-11-18") { (entries, error) in
    if error != nil{
        print(error!.localizedDescription)
        return
    }

    print(entries!) //Array of ChartEntry
}

//FOR A PARTICULAR DATE (with individual date components)
manager.getChart(chartType: ChartType.hot100, day: 18, month: 11, year: 2018) { (entries, error) in
    if error != nil{
        print(error!.localizedDescription)
        return
    }

    print(entries!) //Array of ChartEntry
}

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 9.0+ / OSX 10.10+
  • Swift 4.0+

Installation

Cocoa Pods

To install, simply add the following line to your Podfile:

pod 'BillboardSwiftLibrary'

Swift Package Manager

Add BillboardSwiftLibrary to your Package.swift

import PackageDescription

let package = Package(
dependencies: [
    package(url: "https://github.com/FitzAfful/BillboardSwiftLibrary.git", "0.1.2")
])

Chart entry attributes

A chart entry (typically a single track) is of type ChartEntry. A ChartEntry instance has the following attributes:

  • title – The title of the track.
  • artist – The name of the artist, as formatted on Billboard.com.
  • peakPos – The track’s peak position on the chart at any point in time, including future dates, as an int (or None if the chart does not include this information).
  • lastPos – The track’s position on the previous week’s chart, as an int (or None if the chart does not include this information). This value is 0 if the track was not on the previous week’s chart.
  • weeks – The number of weeks the track has been or was on the chart, including future dates (up until the present time).
  • rank – The track’s current position on the chart.
  • isNew – Whether the track is new to the chart.

Contributing

Pull requests are welcome!

Think you found a bug? Create an issue here.

Based on Billboard.py by Allen Guo

Author

Fitzafful, [email protected]

License

BillboardSwiftLibrary is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "BillboardSwiftLibrary",
    "version": "0.1.4",
    "summary": "Swift API for downloading Billboard charts",
    "description": "BillboardSwiftLibrary is a Swift API for accessing music charts from Billboard.com.",
    "homepage": "https://github.com/Fitzafful/BillboardSwiftLibrary",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Fitzafful": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Fitzafful/BillboardSwiftLibrary.git",
        "tag": "0.1.4"
    },
    "social_media_url": "https://twitter.com/Bra_Gerald",
    "swift_version": "4.0",
    "platforms": {
        "ios": "9.0",
        "osx": "10.10"
    },
    "source_files": "Sources/**/*",
    "dependencies": {
        "SwiftSoup": [
            "~> 1.7.4"
        ]
    }
}

Pin It on Pinterest

Share This