From 69ce8106ceb240d689e1949fb0cc65efaac52cb9 Mon Sep 17 00:00:00 2001 From: Joseph Date: Fri, 13 Aug 2021 03:54:37 +0000 Subject: [PATCH] [BingSearchBridge] Remove bridge (#2242) Microsoft has removed the bing search discover functionality. https://www.bing.com/discover/ pages now redirect to https://www.bing.com/images/trending --- bridges/BingSearchBridge.php | 119 ----------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 bridges/BingSearchBridge.php diff --git a/bridges/BingSearchBridge.php b/bridges/BingSearchBridge.php deleted file mode 100644 index 357feb6c..00000000 --- a/bridges/BingSearchBridge.php +++ /dev/null @@ -1,119 +0,0 @@ - array( - 'category' => array( - 'name' => 'Categories', - 'type' => 'list', - 'values' => self::IMAGE_DISCOVER_CATEGORIES - ), - 'image_size' => array( - 'name' => 'Image size', - 'type' => 'list', - 'values' => array( - 'Small' => 'turl', - 'Full size' => 'imgurl' - ) - ) - ) - ); - - const IMAGE_DISCOVER_CATEGORIES = array( - 'Abstract' => 'abstract', - 'Animals' => 'animals', - 'Anime' => 'anime', - 'Architecture' => 'architecture', - 'Arts and Crafts' => 'arts-and-crafts', - 'Beauty' => 'beauty', - 'Cars and Motorcycles' => 'cars-and-motorcycles', - 'Cats' => 'cats', - 'Celebrities' => 'celebrities', - 'Comics' => 'comics', - 'DIY' => 'diy', - 'Dogs' => 'dogs', - 'Fitness' => 'fitness', - 'Food and Drink' => 'food-and-drink', - 'Funny' => 'funny', - 'Gadgets' => 'gadgets', - 'Gardening' => 'gardening', - 'Geeky' => 'geeky', - 'Hairstyles' => 'hairstyles', - 'Home Decor' => 'home-decor', - 'Marine Life' => 'marine-life', - 'Men\'s Fashion' => 'men%27s-fashion', - 'Nature' => 'nature', - 'Outdoors' => 'outdoors', - 'Parenting' => 'parenting', - 'Phone Wallpapers' => 'phone-wallpapers', - 'Photography' => 'photography', - 'Quotes' => 'quotes', - 'Recipes' => 'recipes', - 'Snow' => 'snow', - 'Tattoos' => 'tattoos', - 'Travel' => 'travel', - 'Video Games' => 'video-games', - 'Weddings' => 'weddings', - 'Women\'s Fashion' => 'women%27s-fashion', - ); - - public function getIcon() - { - return 'https://www.bing.com/sa/simg/bing_p_rr_teal_min.ico'; - } - - public function collectData() - { - $this->items = $this->imageDiscover($this->getInput('category')); - } - - public function getName() - { - if ($this->getInput('category')) { - if (self::IMAGE_DISCOVER_CATEGORIES[$this->getInput('categories')] !== null) { - $category = self::IMAGE_DISCOVER_CATEGORIES[$this->getInput('categories')]; - } else { - $category = 'Unknown'; - } - - return 'Best ' . $category . ' - Bing Image Discover'; - } - return parent::getName(); - } - - private function imageDiscover($category) - { - $html = getSimpleHTMLDOM(self::URI . '/discover/' . $category) - or returnServerError('Could not request ' . self::NAME); - $sizeKey = $this->getInput('image_size'); - - $items = array(); - foreach ($html->find('a.iusc') as $element) { - $data = json_decode(htmlspecialchars_decode($element->getAttribute('m')), true); - - $item = array(); - $item['title'] = basename(rtrim($data['imgurl'], '/')); - $item['uri'] = $data['imgurl']; - $item['content'] = ' - ' . $item['title'] . ' -

Source:

'; - $item['enclosures'] = $data['imgurl']; - - $items[] = $item; - } - return $items; - } - - private function curUrl($url) - { - if (strlen($url) <= 80) { - return $url; - } - return substr($url, 0, 80) . '...'; - } -}