Browse code
Initial commit
Most stuff works, I should come back to this utility for converting
linkblogs to rss feeds someday.
Showing 5 changed files
0 | 2 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,16 @@ |
1 |
+;;;; bigpulpit-puller.asd |
|
2 |
+ |
|
3 |
+(asdf:defsystem #:bigpulpit-puller |
|
4 |
+ :description "Describe bigpulpit-puller here" |
|
5 |
+ :author "Your Name <your.name@example.com>" |
|
6 |
+ :license "Specify license here" |
|
7 |
+ :depends-on (#:alimenta |
|
8 |
+ #:araneus |
|
9 |
+ #:alexandria |
|
10 |
+ #:anaphora |
|
11 |
+ #:serapeum |
|
12 |
+ #:fwoar.lisputils) |
|
13 |
+ :serial t |
|
14 |
+ :components ((:file "package") |
|
15 |
+ (:file "bigpulpit-puller"))) |
|
16 |
+ |
0 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,55 @@ |
1 |
+;;;; bigpulpit-puller.lisp |
|
2 |
+ |
|
3 |
+(in-package #:bigpulpit-puller) |
|
4 |
+ |
|
5 |
+;;; "bigpulpit-puller" goes here. Hacks and glory await! |
|
6 |
+ |
|
7 |
+ |
|
8 |
+(defconstant +feed-url+ "http://bigpulpit.com/feed/atom") |
|
9 |
+ |
|
10 |
+(defparameter *feed-data* (alimenta.pull-feed:pull-feed +feed-url+ :type :atom)) |
|
11 |
+ |
|
12 |
+(defparameter *feed-items* (alimenta:items *feed-data*)) |
|
13 |
+ |
|
14 |
+(defparameter *items-content* (mapcar #'alimenta:content *feed-items*)) |
|
15 |
+ |
|
16 |
+(defparameter *item-links* |
|
17 |
+ (loop for content in *items-content* |
|
18 |
+ for item in *feed-items* |
|
19 |
+ nconcing (coerce |
|
20 |
+ (remove-if |
|
21 |
+ (fw.lu:destructuring-lambda ((url . text)) |
|
22 |
+ (let ((text (string-trim '(#\Space #\Newline) (or (car text) "")))) |
|
23 |
+ (or |
|
24 |
+ (string-equal url "#" :end1 1) |
|
25 |
+ (string-equal url "/" :end1 1) |
|
26 |
+ (string-equal text "") |
|
27 |
+ (string-equal url #1="http://bigpulpit.com" :end1 (length #1#))))) |
|
28 |
+ (lquery:$ (initialize content) "a" (combine (attr "href") (text)) |
|
29 |
+ (map-apply |
|
30 |
+ (lambda (url text) |
|
31 |
+ (list url text |
|
32 |
+ (slot-value item 'alimenta:date)))))) |
|
33 |
+ 'list))) |
|
34 |
+ |
|
35 |
+(defparameter *new-feed* (make-instance 'alimenta.atom::atom-feed |
|
36 |
+ :title "BP Links" |
|
37 |
+ :link "http://example.com/nowhere" |
|
38 |
+ :authors (list "Big Pulpit") |
|
39 |
+ :description "A Description" |
|
40 |
+ :items nil)) |
|
41 |
+ |
|
42 |
+(defmethod slot-missing (class (instance (eql *new-feed*)) slot-name operation &optional new-value) |
|
43 |
+ (format t "~&SLOT MISSING: ~A ~A ~A ~A ~A" class instance slot-name operation new-value) |
|
44 |
+ ) |
|
45 |
+ |
|
46 |
+(defparameter *id* 0) |
|
47 |
+(loop for (url text date) in *item-links* |
|
48 |
+ do (alimenta::add-item-to-feed *new-feed* |
|
49 |
+ :next-id (lambda (tmp) (incf *id*)) |
|
50 |
+ :title text |
|
51 |
+ :link url |
|
52 |
+ :date date |
|
53 |
+ :content "") |
|
54 |
+ |
|
55 |
+ ) |
0 | 5 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,33 @@ |
1 |
+* { |
|
2 |
+ box-sizing: border-box; |
|
3 |
+} |
|
4 |
+ |
|
5 |
+channel > title { |
|
6 |
+ font-size: 2em; |
|
7 |
+ font-weight: bold; |
|
8 |
+ display: block; |
|
9 |
+ width: 75%; |
|
10 |
+ outline: thin solid black; |
|
11 |
+ padding: 1em; |
|
12 |
+ margin: 1em auto; |
|
13 |
+} |
|
14 |
+ |
|
15 |
+channel > description , channel > link { |
|
16 |
+ display: block; |
|
17 |
+ width: 75%; |
|
18 |
+ outline: thin solid black; |
|
19 |
+ padding: 1em; |
|
20 |
+ margin: 1em auto; |
|
21 |
+} |
|
22 |
+ |
|
23 |
+item { |
|
24 |
+ display: block; |
|
25 |
+ width: 75%; |
|
26 |
+ outline: thin solid black; |
|
27 |
+ padding: 1em; |
|
28 |
+ margin: 1em auto; |
|
29 |
+} |
|
30 |
+ |
|
31 |
+item > title { |
|
32 |
+ display: block; |
|
33 |
+} |