From 4e85f6b749aaf6063eb28a9cc2655a64eec1308a Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Sun, 7 Mar 2021 21:37:01 +0100 Subject: [PATCH] API: set some common user agent Some internet sites might prevent us from access unless some sort of a user agent is set --- lib/gst/clapper/gstclapper.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/gst/clapper/gstclapper.c b/lib/gst/clapper/gstclapper.c index ef459552..e09c46ce 100644 --- a/lib/gst/clapper/gstclapper.c +++ b/lib/gst/clapper/gstclapper.c @@ -2743,7 +2743,16 @@ mute_notify_cb (G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GParamSpec * pspec, static void source_setup_cb (GstElement * playbin, GstElement * source, GstClapper * self) { + GParamSpec *prop = g_object_class_find_property (G_OBJECT_GET_CLASS (source), + "user-agent"); + if (prop && prop->value_type == G_TYPE_STRING) { + const gchar *user_agent = + "Mozilla/5.0 (X11; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0"; + + GST_INFO_OBJECT (self, "Setting source user-agent: %s", user_agent); + g_object_set (source, "user-agent", user_agent, NULL); + } } static gpointer