File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ defmodule CF.Videos.CaptionsFetcherYoutube do
9
9
require Logger
10
10
import SweetXml
11
11
12
+ @ user_agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/135.0"
13
+
12
14
@ impl true
13
15
def fetch ( % { youtube_id: youtube_id , language: language } ) do
14
16
with { :ok , data } <- fetch_youtube_data ( youtube_id ) ,
@@ -27,7 +29,7 @@ defmodule CF.Videos.CaptionsFetcherYoutube do
27
29
defp fetch_youtube_data ( video_id ) do
28
30
url = "https://www.youtube.com/watch?v=#{ video_id } "
29
31
30
- case HTTPoison . get ( url , [ ] ) do
32
+ case HTTPoison . get ( url , [ { "User-Agent" , @ user_agent } ] ) do
31
33
{ :ok , % HTTPoison.Response { body: body } } ->
32
34
{ :ok , body }
33
35
@@ -59,7 +61,7 @@ defmodule CF.Videos.CaptionsFetcherYoutube do
59
61
end
60
62
61
63
defp fetch_transcript ( base_url ) do
62
- case HTTPoison . get ( base_url , [ ] ) do
64
+ case HTTPoison . get ( base_url , [ { "User-Agent" , @ user_agent } ] ) do
63
65
{ :ok , % HTTPoison.Response { body: body } } ->
64
66
{ :ok , body }
65
67
You can’t perform that action at this time.
0 commit comments