@@ -114,7 +114,7 @@ namespace :news do
114114 # 2. WordPress REST API からすべての投稿を取得
115115 dojo_news_items = [ ]
116116 loop . with_index ( 1 ) do |_ , index |
117- uri = URI ( "https://news.coderdojo.jp/wp-json/wp/v2/posts" )
117+ uri = URI ( "https://news.coderdojo.jp/wp-json/wp/v2/posts" )
118118 uri . query = URI . encode_www_form ( page : index , per_page : 100 , status : 'publish' )
119119
120120 response = Net ::HTTP . get_response ( uri )
@@ -131,14 +131,13 @@ namespace :news do
131131 }
132132 end
133133
134- TASK_LOGGER . info ( "📄 WordPress API: ページ #{ page } から #{ posts . size } 件取得" )
135- page += 1
134+ TASK_LOGGER . info ( "📄 WordPress API: ページ #{ index } から #{ posts . size } 件取得" )
136135 end
137136 TASK_LOGGER . info ( "📰 news.coderdojo.jp から #{ dojo_news_items . size } 件を取得" )
138137
139138 # 3. PR TIMES RSS フィードからすべてのプレスリリースを取得
140139 prtimes_items = [ ]
141- feed = RSS ::Parser . parse ( 'https://prtimes.jp/companyrdf.php?company_id=38935' , false )
140+ feed = RSS ::Parser . parse ( PR_TIMES_FEED , false )
142141 feed . items . each do |item |
143142 published_at = if item . respond_to? ( :dc_date ) && item . dc_date
144143 item . dc_date . iso8601
@@ -147,12 +146,11 @@ namespace :news do
147146 end
148147
149148 prtimes_items << {
150- 'url' => item . link ,
151- 'title' => item . title ,
149+ 'url' => item . link ,
150+ 'title' => item . title ,
152151 'published_at' => published_at
153152 }
154153 end
155- TASK_LOGGER . info ( "📢 PR TIMES RSS: #{ prtimes_items . size } 件取得" )
156154 TASK_LOGGER . info ( "📢 PR TIMES から #{ prtimes_items . size } 件を取得" )
157155
158156 # 4. すべてのアイテムをマージし、ID を付与
0 commit comments