Skip to content

Commit

Permalink
ddist
Browse files Browse the repository at this point in the history
  • Loading branch information
daileyet committed Aug 13, 2015
1 parent 42752d5 commit c25b511
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 4 deletions.
62 changes: 60 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,60 @@
# SafaribooksonlineGetter4J
The auto download for Safari online book
# SafaribooksonlineGetter4J
The auto download for Safari online book

### How to use it?
Execute the following command line:
```
java -jar SafariBookGetter.jar -config W:\Book\default_config.xml
```

### Configuration items
```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<!--[option]Browser client: FF31; FF38; IE8; IE11; CHROME-->
<entry key="browser-version">FF38</entry>
<!--[option]proxy host if present-->
<entry key="proxy-host"></entry>
<!--[option]proxy host port-->
<entry key="proxy-port">80</entry>
<!--[required]download save directory-->
<entry key="save-dir">W:\Book\android-studio-essentials</entry>
<!--[required]identity the authorized for the download pages-->
<entry key="need-login">true</entry>
<!--required when need login-->
<!--[required]the login page url-->
<entry key="login-url">https://www.safaribooksonline.com/accounts/login/</entry>
<!--[required]the login page form css selector-->
<entry key="login-form-selector">form</entry>
<!--[option]the login page form index-->
<entry key="login-form-index">0</entry>
<!--[required]the login page form user name input name-->
<entry key="login-form-username-input-name"></entry>
<!--[required]the login page form user name value-->
<entry key="login-form-username-input-value"></entry>
<!--[required]the login page form user pass input name-->
<entry key="login-form-password-input-name"></entry>
<!--[required]the login page form user pass value-->
<entry key="login-form-password-input-value"></entry>
<!--[required]the login page form submit button name-->
<entry key="login-form-submit-name"></entry>
<!--option when the first page url configured-->
<!--The catalog page url-->
<entry key="pages-catalog-url">http://techbus.safaribooksonline.com/book/programming/android/9781784397203</entry>
<!--The css selector for each download page anchor on catalog page-->
<entry key="catalog-pagelinks-selector">div.catalog_container a[href*='9781784397203']</entry>
<!--option when the catalog page url configured-->
<!--The first page url-->
<entry key="pages-first-url">http://techbus.safaribooksonline.com/book/programming/android/9781784397203/android-studio-essentials/index_html</entry>
<!--The css selector for next chain page anchor on each page -->
<entry key="pages-next-anchor-selector">a.next[title*='Next (Key: n)']</entry>
</properties>
```

Binary file added dist/SafariBookGetter.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ protected static SafariBookConfigure initialConfig(String[] args) {
// config.setNextChainPageAnchorSelector("");
// config.setProxyHost("");
// config.setProxyPort(80);
String config_path = "W:\\book\\config_default.xml";
String config_path = null;
if (args != null && args.length > 0) {
if ("-help".equalsIgnoreCase(args[0])) {
showUsage();
}
if ("-config".equalsIgnoreCase(args[0])) {
if (args.length > 2) {
if (args.length >= 2) {
config_path = args[1];
} else {
System.out.println("miss configure file path!");
Expand Down

0 comments on commit c25b511

Please sign in to comment.