项目作者: spiegel-im-spiegel

项目描述 :
Search for Books Data
高级语言: Go
项目地址: git://github.com/spiegel-im-spiegel/books-data.git
创建时间: 2019-07-19T12:50:48Z
项目社区:https://github.com/spiegel-im-spiegel/books-data

开源协议:Apache License 2.0

下载


books-data — Search for Books Data

check vulns
lint status
GitHub license
GitHub release

This package is required Go 1.16 or later.

Migrated repository to github.com/goark/books-data

Build and Install

  1. $ go install github.com/goark/books-data@latest

Binaries

See latest release.

Usage

  1. $ books-data -h
  2. Search for books data
  3. Usage:
  4. books-data [flags]
  5. books-data [command]
  6. Available Commands:
  7. help Help about any command
  8. history Lookup review data from history log
  9. review Make review data
  10. search Search for books data
  11. version Print the version number
  12. Flags:
  13. --access-key string Config: PA-API Access Key ID
  14. -c, --aozora-card string Aozora-bunko card no.
  15. -a, --asin string Amazon ASIN code
  16. --associate-tag string Config: PA-API Associate Tag
  17. --config string Config file (default /home/username/.config/books-data/config.yaml)
  18. --debug for debug
  19. -h, --help help for books-data
  20. -i, --isbn string ISBN code
  21. --marketplace string Config: PA-API Marketplace (default "www.amazon.co.jp")
  22. -l, --review-log string Config: Review log file (JSON format)
  23. --secret-key string Config: PA-API Secret Access Key
  24. -t, --template-file string Template file for formatted output
  25. Use "books-data [command] --help" for more information about a command.

Config file

  1. $ cat ~/.config/books-data/config.yaml
  2. marketplace: www.amazon.co.jp
  3. associate-tag: mytag-20
  4. access-key: AKIAIOSFODNN7EXAMPLE
  5. secret-key: 1234567890
  6. review-log: /home/username/review-log.json

Search for books data

  1. $ books-data search -h
  2. Search for books data
  3. Usage:
  4. books-data search [flags]
  5. Flags:
  6. -h, --help help for search
  7. --raw Output raw data from API
  8. Global Flags:
  9. --access-key string Config: PA-API Access Key ID
  10. -c, --aozora-card string Aozora-bunko card no.
  11. -a, --asin string Amazon ASIN code
  12. --associate-tag string Config: PA-API Associate Tag
  13. --config string Config file (default /home/username/.config/books-data/config.yaml)
  14. --debug for debug
  15. -i, --isbn string ISBN code
  16. --marketplace string Config: PA-API Marketplace (default "www.amazon.co.jp")
  17. -l, --review-log string Config: Review log file (JSON format)
  18. --secret-key string Config: PA-API Secret Access Key
  19. -t, --template-file string Template file for formatted output
  20. $ books-data search -a 427406932X | jq .
  21. {
  22. "Type": "paapi",
  23. "ID": "427406932X",
  24. "Title": "リーン開発の現場 カンバンによる大規模プロジェクトの運営",
  25. "URL": "https://www.amazon.co.jp/dp/427406932X?tag=mytag-22&linkCode=ogi&th=1&psc=1",
  26. "Image": {
  27. "URL": "https://m.media-amazon.com/images/I/51llL1uygcL._SL160_.jpg",
  28. "Height": 160,
  29. "Width": 116
  30. },
  31. "ProductType": "単行本(ソフトカバー)",
  32. "Creators": [
  33. {
  34. "Name": "Henrik Kniberg",
  35. "Role": "著"
  36. },
  37. {
  38. "Name": "角谷 信太郎",
  39. "Role": "翻訳"
  40. },
  41. {
  42. "Name": "市谷 聡啓",
  43. "Role": "翻訳"
  44. },
  45. {
  46. "Name": "藤原 大",
  47. "Role": "翻訳"
  48. }
  49. ],
  50. "Publisher": "オーム社",
  51. "Codes": [
  52. {
  53. "Name": "ASIN",
  54. "Value": "427406932X"
  55. },
  56. {
  57. "Name": "EAN",
  58. "Value": "9784274069321"
  59. },
  60. {
  61. "Name": "ISBN",
  62. "Value": "427406932X"
  63. }
  64. ],
  65. "PublicationDate": "2013-10-26",
  66. "LastRelease": "",
  67. "Service": {
  68. "Name": "PA-APIv5",
  69. "URL": "https://affiliate.amazon.co.jp/assoc_credentials/home"
  70. }
  71. }

Make review data

  1. $ books-data review -h
  2. Make review data
  3. Usage:
  4. books-data review [flags] [description]
  5. Flags:
  6. --bookpage-url string URL of book page
  7. -h, --help help for review
  8. --image-url string URL of book cover image
  9. --pipe Import description from Stdin
  10. -r, --rating int Rating of product
  11. --review-date string Date of review
  12. Global Flags:
  13. --access-key string Config: PA-API Access Key ID
  14. -c, --aozora-card string Aozora-bunko card no.
  15. -a, --asin string Amazon ASIN code
  16. --associate-tag string Config: PA-API Associate Tag
  17. --config string Config file (default /home/username/.config/books-data/config.yaml)
  18. --debug for debug
  19. -i, --isbn string ISBN code
  20. --marketplace string Config: PA-API Marketplace (default "www.amazon.co.jp")
  21. -l, --review-log string Config: Review log file (JSON format)
  22. --secret-key string Config: PA-API Secret Access Key
  23. -t, --template-file string Template file for formatted output
  24. $ books-data review -i 427406932X -r 5 "This book is Interesting." | jq .
  25. {
  26. "Book": {
  27. "Type": "openbd",
  28. "ID": "9784274069321",
  29. "Title": "リーン開発の現場 : カンバンによる大規模プロジェクトの運営",
  30. "Image": {
  31. "URL": "https://cover.openbd.jp/9784274069321.jpg"
  32. },
  33. "ProductType": "Book",
  34. "Creators": [
  35. {
  36. "Name": "Kniberg, Henrik"
  37. },
  38. {
  39. "Name": "オーム社"
  40. },
  41. {
  42. "Name": "オーム社開発局"
  43. },
  44. {
  45. "Name": "市谷 聡啓"
  46. },
  47. {
  48. "Name": "藤原 大"
  49. },
  50. {
  51. "Name": "角谷 信太郎"
  52. },
  53. {
  54. "Name": "クニバーグ ヘンリック"
  55. }
  56. ],
  57. "Publisher": "オーム社",
  58. "Codes": [
  59. {
  60. "Name": "ISBN",
  61. "Value": "9784274069321"
  62. }
  63. ],
  64. "PublicationDate": "2013-10-01",
  65. "LastRelease": "",
  66. "Service": {
  67. "Name": "openBD",
  68. "URL": "https://openbd.jp/"
  69. }
  70. },
  71. "Date": "2019-10-05",
  72. "Rating": 5,
  73. "Star": [
  74. true,
  75. true,
  76. true,
  77. true,
  78. true
  79. ],
  80. "Description": "This book is Interesting."
  81. }
  82. $ cat ~/review-log.json
  83. [
  84. {
  85. "Book": {
  86. "Type": "openbd",
  87. "ID": "9784274069321",
  88. "Title": "リーン開発の現場 : カンバンによる大規模プロジェクトの運営",
  89. "Image": {
  90. "URL": "https://cover.openbd.jp/9784274069321.jpg"
  91. },
  92. "ProductType": "Book",
  93. "Creators": [
  94. {
  95. "Name": "Kniberg, Henrik"
  96. },
  97. {
  98. "Name": "オーム社"
  99. },
  100. {
  101. "Name": "オーム社開発局"
  102. },
  103. {
  104. "Name": "市谷 聡啓"
  105. },
  106. {
  107. "Name": "藤原 大"
  108. },
  109. {
  110. "Name": "角谷 信太郎"
  111. },
  112. {
  113. "Name": "クニバーグ ヘンリック"
  114. }
  115. ],
  116. "Publisher": "オーム社",
  117. "Codes": [
  118. {
  119. "Name": "ISBN",
  120. "Value": "9784274069321"
  121. }
  122. ],
  123. "PublicationDate": "2013-10-01",
  124. "LastRelease": "",
  125. "Service": {
  126. "Name": "openBD",
  127. "URL": "https://openbd.jp/"
  128. }
  129. },
  130. "Date": "2019-10-05",
  131. "Rating": 5,
  132. "Star": [
  133. true,
  134. true,
  135. true,
  136. true,
  137. true
  138. ],
  139. "Description": "This book is Interesting."
  140. }
  141. ]

Lookup review data from history

  1. $ books-data history -h
  2. Lookup review data from history log
  3. Usage:
  4. books-data history [flags]
  5. Flags:
  6. -h, --help help for history
  7. Global Flags:
  8. --access-key string Config: PA-API Access Key ID
  9. -c, --aozora-card string Aozora-bunko card no.
  10. -a, --asin string Amazon ASIN code
  11. --associate-tag string Config: PA-API Associate Tag
  12. --config string Config file (default /home/username/.config/books-data/config.yaml)
  13. --debug for debug
  14. -i, --isbn string ISBN code
  15. --marketplace string Config: PA-API Marketplace (default "www.amazon.co.jp")
  16. -l, --review-log string Config: Review log file (JSON format)
  17. --secret-key string Config: PA-API Secret Access Key
  18. -t, --template-file string Template file for formatted output
  19. $ books-data history -i 9784274069321 | jq .
  20. {
  21. "Book": {
  22. "Type": "openbd",
  23. "ID": "9784274069321",
  24. "Title": "リーン開発の現場 : カンバンによる大規模プロジェクトの運営",
  25. "Image": {
  26. "URL": "https://cover.openbd.jp/9784274069321.jpg"
  27. },
  28. "ProductType": "Book",
  29. "Creators": [
  30. {
  31. "Name": "Kniberg, Henrik"
  32. },
  33. {
  34. "Name": "オーム社"
  35. },
  36. {
  37. "Name": "オーム社開発局"
  38. },
  39. {
  40. "Name": "市谷 聡啓"
  41. },
  42. {
  43. "Name": "藤原 大"
  44. },
  45. {
  46. "Name": "角谷 信太郎"
  47. },
  48. {
  49. "Name": "クニバーグ ヘンリック"
  50. }
  51. ],
  52. "Publisher": "オーム社",
  53. "Codes": [
  54. {
  55. "Name": "ISBN",
  56. "Value": "9784274069321"
  57. }
  58. ],
  59. "PublicationDate": "2013-10-01",
  60. "LastRelease": "",
  61. "Service": {
  62. "Name": "openBD",
  63. "URL": "https://openbd.jp/"
  64. }
  65. },
  66. "Date": "2019-10-05",
  67. "Rating": 5,
  68. "Star": [
  69. true,
  70. true,
  71. true,
  72. true,
  73. true
  74. ],
  75. "Description": "This book is Interesting."
  76. }

Formatted output by template file

  1. $ books-data search -a 427406932X -t testdata/book-template/template.bib.txt
  2. @BOOK{Book:427406932X,
  3. TITLE = "リーン開発の現場 カンバンによる大規模プロジェクトの運営",
  4. AUTHOR = "Henrik Kniberg (著) and 角谷 信太郎 (翻訳) and 市谷 聡啓 (翻訳) and 藤原 大 (翻訳)",
  5. PUBLISHER = {オーム社},
  6. YEAR = 2013
  7. }
  8. $ books-data history -i 9784274069321 -t testdata/review-template/template.html
  9. <div class="hreview">
  10. <div class="photo"><img src="https://cover.openbd.jp/9784274069321.jpg" alt="photo"></div>
  11. <dl class="fn">
  12. <dt>リーン開発の現場 : カンバンによる大規模プロジェクトの運営</dt>
  13. <dd>Kniberg, Henrik, オーム社, オーム社開発局, 市谷 聡啓, 藤原 大, 角谷 信太郎, クニバーグ ヘンリック</dd>
  14. <dd>オーム社 2013-10-01</dd>
  15. <dd>Book</dd>
  16. <dd>9784274069321 (ISBN)</dd>
  17. <dd>Rating<abbr class="rating fa-sm" title="5"> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i></abbr></dd>
  18. </dl>
  19. <p class="description">This book is Interesting.</p>
  20. <p class="powered-by" >reviewed by <a href='#maker' class='reviewer'>Spiegel</a> on <abbr class="dtreviewed" title="2019-10-05">2019-10-05</abbr> (powered by <a href="https://openbd.jp/" >openBD</a>)</p>
  21. </div>

Modules Requirement Graph

dependency.png

Reference