File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change
1
+ const _WISHLIST_PATH = 'src/_data/toread.yml' ;
2
+
3
+ export interface WishListBook {
4
+ title : string ;
5
+ slug : string ;
6
+ author : string ;
7
+ addedAt : Date ;
8
+ notes ?: string ;
9
+ }
Original file line number Diff line number Diff line change 1
1
import { encodeBase64 } from 'jsr:@std/encoding/base64' ;
2
+ import { slug } from 'slug' ;
3
+ import { type WishListBook } from '../api/model/wishlist.ts' ;
2
4
3
5
// Rewritten from Python (https://github.com/subdavis/kobo-book-downloader/blob/main/kobodl/kobo.py) by Johan.
4
6
// Huge props to the great reverse engineering by them.
@@ -19,7 +21,14 @@ const main = async () => {
19
21
const settings = await loadInitSettings ( accessToken ) ;
20
22
const wishlist = await fetchWishlist ( accessToken , settings . user_wishlist ) ;
21
23
22
- console . log ( JSON . stringify ( wishlist , null , 2 ) ) ;
24
+ const books = wishlist . map < WishListBook > ( ( w ) => ( {
25
+ title : w . ProductMetadata . Book . Title ,
26
+ author : w . ProductMetadata . Book . Contributors ,
27
+ slug : slug ( w . ProductMetadata . Book . Title ) ,
28
+ addedAt : w . DateAdded ,
29
+ } ) ) ;
30
+
31
+ console . log ( books ) ;
23
32
} catch ( error ) {
24
33
console . error ( error ) ;
25
34
}
You can’t perform that action at this time.
0 commit comments