From 7c96334e3b66ab02f63bcbe71093f75ccd56fdb1 Mon Sep 17 00:00:00 2001 From: Corentin Garcia Date: Sat, 1 Oct 2022 08:42:50 +0200 Subject: [PATCH] [GithubSearchBridge] Add programming language (#3074) --- bridges/GithubSearchBridge.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bridges/GithubSearchBridge.php b/bridges/GithubSearchBridge.php index 658c4d7c..f477710f 100644 --- a/bridges/GithubSearchBridge.php +++ b/bridges/GithubSearchBridge.php @@ -49,7 +49,7 @@ class GithubSearchBridge extends BridgeAbstract $tags = $element->find('a.topic-tag'); $tags_array = []; if (count($tags) != 0) { - $content = $content . 'Tags : '; + $content = $content . 'Tags: '; foreach ($tags as $tag_element) { $tag_link = 'https://github.com' . $tag_element->href; $tag_name = trim($tag_element->innertext); @@ -58,6 +58,14 @@ class GithubSearchBridge extends BridgeAbstract } } + // Programming language + if (count($element->find('span[itemprop=programmingLanguage]')) != 0) { + $language = $element->find('span[itemprop=programmingLanguage]', 0)->innertext; + + $content = $content . '
'; + $content = $content . 'Language: ' . $language; + } + $item['categories'] = $tags_array; $item['content'] = $content; $date = $element->find('relative-time', 0)->datetime;