Method: Webhookdb::Replicator::TransistorEpisodeV1#_fetch_enrichment

Defined in:
lib/webhookdb/replicator/transistor_episode_v1.rb

#_fetch_enrichment(resource) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/webhookdb/replicator/transistor_episode_v1.rb', line 140

def _fetch_enrichment(resource, *)
  transcript_url = resource.fetch("attributes").fetch("transcript_url", nil)
  return nil if transcript_url.blank?
  (transcript_url += ".txt") unless transcript_url.end_with?(".txt")
  begin
    resp = Webhookdb::Http.get(
      transcript_url,
      logger: self.logger,
      timeout: Webhookdb::Transistor.http_timeout,
    )
  rescue Webhookdb::Http::Error => e
    # Not sure why this happens, but nothing we can do if it does.
    return nil if e.status == 404
    raise e
  end
  transcript_text = resp.body
  return {transcript_text:}
end