@@ -45,25 +45,21 @@ func run() (string, error) {
4545 flag .Parse ()
4646 now := time .Now ()
4747 feed := & feeds.Feed {
48- Title : fmt .Sprintf ("4chan threads from multiple boards" ),
49- Link : & feeds.Link {Href : "https://boards.4channel.org/" },
50- Description : fmt .Sprintf (
51- "threads from multiple boards with more than %d comments" ,
52- options .replies ,
53- ),
54- Author : & feeds.Author {Name : "Anon" },
55- Created : now ,
48+ Title : fmt .Sprintf ("4chan threads from multiple boards" ),
49+ Link : & feeds.Link {Href : "https://boards.4channel.org/" },
50+ Description : fmt .Sprintf ("threads from multiple boards with more than %d comments" , options .replies ),
51+ Author : & feeds.Author {Name : "Anon" },
52+ Created : now ,
5653 }
5754
58- // Split the board names by commas and process each board
5955 boards := strings .Split (options .boardNames , "," )
6056 var allItems []* feeds.Item
6157 for _ , board := range boards {
6258 threads , err := getThreads (board , options .pages )
6359 if err != nil {
6460 return "" , err
6561 }
66- items := processThreads (threads )
62+ items := processThreads (threads , board )
6763 allItems = append (allItems , items ... )
6864 }
6965
@@ -86,24 +82,24 @@ func getThreads(board string, pages uint) (threads []*api.Thread, err error) {
8682 return
8783}
8884
89- func processThreads (threads []* api.Thread ) []* feeds.Item {
85+ func processThreads (threads []* api.Thread , board string ) []* feeds.Item {
9086 var items []* feeds.Item
9187 for _ , thread := range threads {
9288 if thread .Replies () < int (options .replies ) {
9389 continue
9490 }
95- item := processPost (thread .OP )
91+ item := processPost (thread .OP , board )
9692 item .Title = fmt .Sprintf ("[%3d] %s" , min (999 , thread .Replies ()), item .Title )
9793 items = append (items , item )
9894 }
9995 return items
10096}
10197
102- func processPost (post * api.Post ) * feeds.Item {
98+ func processPost (post * api.Post , board string ) * feeds.Item {
10399 item := & feeds.Item {}
104100 item .Title = getTitle (post )
105101 item .Link = & feeds.Link {
106- Href : fmt .Sprintf ("https://boards.4channel.org/%s/thread/%d/" , options . boardNames , post .Id ), // Use options.boardName here
102+ Href : fmt .Sprintf ("https://boards.4channel.org/%s/thread/%d/" , board , post .Id ),
107103 }
108104 item .Description = anchorize (strings .ReplaceAll (post .Comment , "<wbr>" , "" ))
109105 if post .File != nil {
0 commit comments