Skip to content

Commit

Permalink
Take random comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed committed Feb 24, 2018
1 parent 9ea711c commit d5f0ee8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/commands.ex
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ defmodule Thonk.Commands do
[{title, video_ref}] = Enum.take_random(videos, 1)

res = HTTPoison.get!("https://www.xvideos.com/video-get-comments/#{video_ref}/0")
comment = res.body
[comment] = res.body
|> Poison.decode!()
|> Map.get("comments")
|> Enum.at(0)
|> Enum.take_random(1)

# Handle empty comments
case comment do
Expand Down

0 comments on commit d5f0ee8

Please sign in to comment.