LoginSignup
6
6

More than 5 years have passed since last update.

peercastの配信情報取得

Last updated at Posted at 2014-10-03

ypから配信情報を取得してみる。

最初は defstruct というものを使ったんですが

Structs are obsolete. Use records instead. See defrecord.

ドキュメントにかかれていたので defrecord を使いました。

pcyp.clj
(ns pcyp-clj.core
  (:require [clojure.string :as str]))

(defrecord Info [name ip genre description kbps type comment])

;; get index.txt
(def txt (slurp "http://bayonet.ddo.jp/sp/index.txt"))

;; split
(def splited-txt (map #(str/split % #"<>") (str/split txt #"\n" )))

(def infos (for [x splited-txt]
  (Info. (first x) (get x 2) (get x 4) (get x 5) (get x 8) (get x 9) (get x 17))))

;; 結果確認
(first infos)

誰か何かアイデアください

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6