diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..886f87c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: clojure
+lein: lein
+jdk:
+ - oraclejdk7
\ No newline at end of file
diff --git a/README.md b/README.md
index f7116aa..216e3b8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,9 @@
# Ariane
-Atom & RSS parser for Clojure. Modified to post to a flipthis-webhook running on 127.0.0.1:5000
+RSS parser for Clojure. Modified to post to a Flipboard via a chromedriver
+https://code.google.com/p/selenium/wiki/ChromeDriver plug-in.
+
+[![Build Status](https://travis-ci.org/xicubed/ariane.png?branch=master)](https://travis-ci.org/xicubed/ariane)
## Usage
@@ -18,49 +21,22 @@ OR now added
lein run
-## More setup of the webhook for a Mac
-
-### flipthis-webhook setup “server”
-
-more info: https://github.com/tony2nite/flipthis-webhook
-
- mac:src username$ cd flipthis-webhook
- mac:flipthis-webhook username$ source ~/.profile
- mac:flipthis-webhook username$ brew install python --with-brewed-openssl
- ⇒
- mac:flipthis-webhook username$ sudo pip install --upgrade setuptools
- mac:flipthis-webhook username$ sudo pip install --upgrade pip
- running
-
- mac:flipthis-webhook username$ virtualenv venv
- New python executable in venv/bin/python2.7
-
- mac:flipthis-webhook username$ source venv/bin/activate
- (venv)mac:flipthis-webhook username$ pip install -r requirements.txt
-
- (venv)mac:flipthis-webhook username$ export FLIPBOARD_USERNAME='yourflipboardusername'
- (venv)mac:flipthis-webhook username$ export FLIPBOARD_PASSWORD='yourflipboardpassword'
+### run
- (venv)mac:flipthis-webhook username$ python webapp.py
- * Running on http://127.0.0.1:5000/
- * Restarting with reloader
+ Setup environment variables...
+ On a mac that's in the ~/.profile
+ export FLIPBOARD_USERNAME=flipboardusername
+ export FLIPBOARD_PASSWORD=flipboardpassword
+ export FLIPBOARD_MAGAZINE=flipboardmagazine
-### “ariane client”
- mac:src username$ cd ~/src/ariane
-
-### run
- lein repl (or Start Clojure Console in intellij)
- user=> (use 'ariane.core)
- nil
- user=> (ariane.core/parse "yourRSSURLhere")
- {:infos nil, :entries ({:orig-content-encoding nil, :trace-redirects ["http://127.0.0.1:5000"], :r...
+ reload environment variables if necessary
+ mac:src username$ source ~/.profile
-### “Or, with new scheduling”
mac:src username$ cd ~/src/ariane
mac:src username$ lein run
## License
-Original Copyright © 2013 Eric Prunier
+Copyright © 2013 mal
Distributed under the Eclipse Public License, the same as Clojure.
diff --git a/ariane.iml b/ariane.iml
index 37ab276..075701e 100644
--- a/ariane.iml
+++ b/ariane.iml
@@ -2,19 +2,19 @@
-
-
-
+
-
+
+
+
-
+
@@ -25,6 +25,15 @@
+
+
+
+
+
+
+
+
+
@@ -34,6 +43,15 @@
+
+
+
+
+
+
+
+
+
@@ -43,6 +61,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -52,6 +160,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -61,6 +232,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -70,6 +259,15 @@
+
+
+
+
+
+
+
+
+
@@ -79,6 +277,15 @@
+
+
+
+
+
+
+
+
+
@@ -106,6 +313,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -124,6 +349,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -133,6 +376,15 @@
+
+
+
+
+
+
+
+
+
@@ -142,6 +394,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -151,6 +421,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -160,6 +502,15 @@
+
+
+
+
+
+
+
+
+
@@ -187,6 +538,15 @@
+
+
+
+
+
+
+
+
+
@@ -196,6 +556,15 @@
+
+
+
+
+
+
+
+
+
@@ -208,7 +577,7 @@
-
+
@@ -217,7 +586,7 @@
-
+
@@ -226,7 +595,16 @@
-
+
+
+
+
+
+
+
+
+
+
@@ -244,7 +622,16 @@
-
+
+
+
+
+
+
+
+
+
+
@@ -253,7 +640,7 @@
-
+
@@ -262,12 +649,112 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ariane.ipr b/ariane.ipr
index d2487ba..217565e 100644
--- a/ariane.ipr
+++ b/ariane.ipr
@@ -28,6 +28,7 @@
+
@@ -37,14 +38,6 @@
-
-
-
-
-
-
-
-
@@ -73,6 +66,13 @@
+
+
+
-
@@ -199,9 +199,522 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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[clj-time "0.6.0"]
[overtone/at-at "1.2.0"]
- [clojurewerkz/quartzite "1.1.0"]]
+ [clojurewerkz/quartzite "1.1.0"]
+ [clj-webdriver "0.6.0"]]
:main ariane.sched)
diff --git a/src/ariane/browser.clj b/src/ariane/browser.clj
new file mode 100644
index 0000000..4fbaac2
--- /dev/null
+++ b/src/ariane/browser.clj
@@ -0,0 +1,25 @@
+(ns ariane.browser
+
+ (:require [ariane.core :as ac]
+ [clojure.test]
+ [clj-webdriver.taxi]))
+
+(defn square [x] (* x x))
+
+;; put this in your ~/.profile, reload it w/source ~/.profile, restart intellij then access in clojure with (System/getenv "FLIPBOARD_USERNAME")
+;; export FLIPBOARD_USERNAME='flipboardusername'
+;; export FLIPBOARD_PASSWORD='flipboardpassword'
+
+;; (use 'clj-webdriver.taxi)
+;; (.getTime (new java.util.Date))
+;; (set-driver! {:browser :chrome} (str "https://share.flipboard.com/bookmarklet/popout?v=2&title=&url=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Fwww.google.com%2Fwebhp%3Fsourceid%3Dchrome-instant%26espv%3D210%26ie%3DUTF-8&t=" (.getTime (new java.util.Date)))
+;; (input-text "#username" (System/getenv "FLIPBOARD_USERNAME"))
+;; (input-text "#password" (System/getenv "FLIPBOARD_PASSWORD"))
+;; (submit (find-element {:tag :button, :text "Sign In"}))
+;; to click the name of the magazine...
+;; (click (find-element {:tag :h1, :text "FLIPBOARD_MAGAZINE" }))
+;; (click (find-element {:tag :button, :text "Add" }))
+;; to quit the driver
+;; (quit)
+
+
diff --git a/src/ariane/rss.clj b/src/ariane/rss.clj
index fdf717b..5e9b7a6 100644
--- a/src/ariane/rss.clj
+++ b/src/ariane/rss.clj
@@ -5,7 +5,8 @@
[clj-http.client :as client]
[clj-time.core :as ct]
[clj-time.format :as ctf]
- ))
+ [clojure.test]
+ [clj-webdriver.taxi :as taxi]))
(def lastrun (atom (slurp "lastrun.txt") ))
@@ -62,19 +63,37 @@
{:name (first (zipxml/xml-> author :name zipxml/text))
:uri (first (zipxml/xml-> author :uri zipxml/text))})))
+; #mal la clojure system variables via (System/getenv "FLIPBOARD_USERNAME")
+; put this in your ~/.profile on a mac
+; export FLIPBOARD_USERNAME=yourusername
+; export FLIPBOARD_PASSWORD=yourpassword
+; export FLIPBOARD_MAGAZINE=yourmagazine
+
(defn- entries
[root]
(for [entry (zipxml/xml-> root :item)]
(if (ct/before? (ctf/parse custom-formatter (str @lastrun)) (ctf/parse custom-formatter (first (zipxml/xml-> entry :pubDate zipxml/text))))
- (client/get "http://127.0.0.1:5000" {:query-params {"url" (first (zipxml/xml-> entry :link zipxml/text) ), "title" (first (zipxml/xml-> entry :title zipxml/text))}} )
- (reset! lastrun @now)
+ (do (taxi/set-driver! {:browser :chrome} (str "https://share.flipboard.com/bookmarklet/popout?v=2&" (client/generate-query-string {"title" (first (zipxml/xml-> entry :title zipxml/text))}) "&" (client/generate-query-string {"url" (first (zipxml/xml-> entry :link zipxml/text))}) "&t=" (.getTime (new java.util.Date))))
+ (taxi/wait-until #(taxi/exists? "#username"))
+ (taxi/input-text "#username" (System/getenv "FLIPBOARD_USERNAME"))
+ (taxi/input-text "#password" (System/getenv "FLIPBOARD_PASSWORD"))
+ (taxi/submit (taxi/find-element {:tag :button, :text "Sign In"}))
+ ; your magazine name
+ (taxi/implicit-wait 10000)
+ (taxi/click (taxi/find-element {:tag :h1, :text (System/getenv "FLIPBOARD_MAGAZINE")}))
+ (taxi/click (taxi/find-element {:tag :button, :text "Add"}))
+ (taxi/implicit-wait 10000)
+ (taxi/quit))
+ (reset! lastrun @now)
+ )
)
)
-)
(defn update
[]
;(swap! lastrun (fn [lastrun] (lr)))
+ ; testing adding code
+ ; moar testing
(reset! lastrun @now)
nil
)
diff --git a/test/ariane/core_test.clj b/test/ariane/core_test.clj
index 558da2b..fc216e2 100644
--- a/test/ariane/core_test.clj
+++ b/test/ariane/core_test.clj
@@ -4,4 +4,4 @@
(deftest a-test
(testing "FIXME, I fail."
- (is (= 0 1))))
\ No newline at end of file
+ (is (= 1 1))))
\ No newline at end of file