Skip to content

Commit

Permalink
Pass in user-agent when hitting Medium API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
julianguyen committed Dec 26, 2023
1 parent 9bce1e1 commit 1c945cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/services/medium.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def posts
private

def content_hash
JSON.parse(content[16..-1])
JSON.parse(content[16..])
end

def content
content = ''
URI.open('https://medium.com/ifme?format=json') do |file|
URI.open('https://medium.com/ifme?format=json', 'User-Agent' => 'if-me.org') do |file|
file.each_line { |line| content += line }
end
content
Expand Down

0 comments on commit 1c945cf

Please sign in to comment.