From d1951602807ab8320ae4b2905ce2d1de9d2ac9f6 Mon Sep 17 00:00:00 2001 From: sriramsv Date: Sun, 28 Aug 2022 18:43:26 -0700 Subject: [PATCH 1/3] Youtube in app search search widget --- community/youtube-widget.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 community/youtube-widget.lua diff --git a/community/youtube-widget.lua b/community/youtube-widget.lua new file mode 100644 index 0000000..a17fff6 --- /dev/null +++ b/community/youtube-widget.lua @@ -0,0 +1,33 @@ +-- name = "Youtube" +-- description = "Search anything in youtube app" +-- data_source = "internal" +-- type = "search" +-- author = "Sriram SV" +-- version = "1.0" +-- prefix = "youtube" + +text_from = "" +text_to = "" +yt_intent_action = "android.intent.action.SEARCH" +yt_intent_category = "android.intent.category.DEFAULT" +yt_package_name = "com.google.android.youtube" + +local md_color = require "md_colors" +local red = md_colors.light_red_800 + +function on_search(input) + text_from = input + text_to = "" + search:show({input},{red}) +end + +function on_click(idx) + intent:start_activity{ + action = yt_intent_action, + category = yt_intent_category, + package = yt_package_name, + data = "query:"..text_from + } +end + + From e5b8ead35249c0cc1680a1e4e18b29d052f7934f Mon Sep 17 00:00:00 2001 From: sriramsv Date: Sun, 28 Aug 2022 18:51:24 -0700 Subject: [PATCH 2/3] Fix intent --- community/youtube-widget.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/community/youtube-widget.lua b/community/youtube-widget.lua index a17fff6..9635eb2 100644 --- a/community/youtube-widget.lua +++ b/community/youtube-widget.lua @@ -13,7 +13,7 @@ yt_intent_category = "android.intent.category.DEFAULT" yt_package_name = "com.google.android.youtube" local md_color = require "md_colors" -local red = md_colors.light_red_800 +local red = md_colors.red_800 function on_search(input) text_from = input @@ -26,7 +26,9 @@ function on_click(idx) action = yt_intent_action, category = yt_intent_category, package = yt_package_name, - data = "query:"..text_from + extras = { + query=text_from + } } end From 1adf7c0454bb17b85237e1919e5cabfb0123efdf Mon Sep 17 00:00:00 2001 From: sriramsv Date: Mon, 29 Aug 2022 10:49:52 -0700 Subject: [PATCH 3/3] change prefix --- community/youtube-widget.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/community/youtube-widget.lua b/community/youtube-widget.lua index 9635eb2..633d016 100644 --- a/community/youtube-widget.lua +++ b/community/youtube-widget.lua @@ -4,7 +4,7 @@ -- type = "search" -- author = "Sriram SV" -- version = "1.0" --- prefix = "youtube" +-- prefix = "youtube|yt" text_from = "" text_to = ""