定制 yanosh-k/duckduckgo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yanosh-k/duckduckgo

Composer 安装命令:

composer require yanosh-k/duckduckgo

包简介

Provides functions for making DuckDuckGo searches using PHP (currently only images)

README 文档

README

This is a PHP version of fastai's Python search_images_ddg() function.

It is part of the code that accompanies their Deep Learning for Coders book (also available on Amazon), which has a function called search_images_ddg().

You can read more more about why this library exists here.

How to

Installation

With composer:

composer require yanosh-k/duckduckgo

Usage

Require the composer autoloader:

<?php
    require_once('vendor/autoload.php');
    $searchResults = YanoshK\DuckDuckGo\SearchImagesDDG('brown dogs');

Function parameters

This function accepts only two parameters: $term and $maxImages: SearchImagesDDG($term, $maxImages = 200).

$term is a string for the search query that you would like to use.

$maxImages is integer between 1 and 1000 and tells the function the maximum number of results to return.

Results

When you call SearchImagesDDG('SEARCH_TERM') you will get an array of results in the format shown bellow. This is the actual data format that DDG is using in their internal API. Most of the times you would need the image parameter value, which holds the URL for the original file:

[
  [
    'height' => 530,
    'image' => 'https://static.semrush.com/blog/uploads/media/21/d9/21d991199d0e7392c20c38736f8fd32c/search-terms-sm.png',
    'image_token' => 'b94f617df3182bb6c99361fb2c2d85c4e72722d46c06afe022e41d6730bb26c6',
    'source' => 'Bing',
    'thumbnail' => 'https://tse4.mm.bing.net/th?id=OIP.mzBL8Sb1e60zZlBY4Pi8kAHaD4&pid=Api',
    'thumbnail_token' => '72056fe36342f76e10075153c3b62ae2814a694c5ffbdb23e1d4ad99fcd0eab9',
    'title' => 'Search Terms: Definition & How to Use Them (with Examples)',
    'url' => 'https://www.semrush.com/blog/search-terms/',
    'width' => 1010,
  ],
  [
    'height' => 1250,
    'image' => 'https://www.reliablesoft.net/wp-content/uploads/2019/06/people-also-ask-related-searches.png',
    'image_token' => '0c4d1e495ef71ac644e8806bccf54d7f8de3f39a0cddfcf39ca305ddfc660380',
    'source' => 'Bing',
    'thumbnail' => 'https://tse1.mm.bing.net/th?id=OIP.6EvNQHr1FyZavhMUl2k_vwHaHG&pid=Api',
    'thumbnail_token' => '653d830b8945e07ac649ff67ed5bdb70366662d29f690ea690211be1b21deb1f',
    'title' => 'What are Search Terms? (With Examples)',
    'url' => 'https://www.reliablesoft.net/what-are-search-terms/',
    'width' => 1304,
  ],
  [
    'height' => 201,
    'image' => 'https://static.semrush.com/blog/uploads/media/8a/09/8a09df80c31b1de73bc90c3c73e6889c/search-term.jpg',
    'image_token' => '0db046ce4e19036d264ac5c6afeb59d16425eeb504dca37c0de7f216fc69707b',
    'source' => 'Bing',
    'thumbnail' => 'https://tse1.mm.bing.net/th?id=OIP.uozMlwbujR9P3JixU9cNTAAAAA&pid=Api',
    'thumbnail_token' => '6334459b50b60891414a126835f438a88b31cf336937e0cf3003c3c1dd5c32b1',
    'title' => 'Search Terms: Definition & How to Use Them (with Examples)',
    'url' => 'https://www.semrush.com/blog/search-terms/',
    'width' => 474,
  ],
  [
    'height' => 1334,
    'image' => 'https://static.semrush.com/blog/uploads/media/02/2a/022ae1572f1ad01af34c62c93cd625b0/google-ads-search-terms-report.jpg',
    'image_token' => '0a3620d50bd6c0f3d76e100a7b59e97f8aad46ba4d859c8e463d0d963eab50a8',
    'source' => 'Bing',
    'thumbnail' => 'https://tse3.mm.bing.net/th?id=OIP.eY0jXwtADz7z7ZTDjfIv6gHaJQ&pid=Api',
    'thumbnail_token' => '9102854a16e33e9767a7690e0b5a8d7cb26e6dec8158be11a8991b407442f267',
    'title' => 'Search Terms: Definition & How to Use Them (with Examples)',
    'url' => 'https://www.semrush.com/blog/search-terms/',
    'width' => 1068,
  ]

yanosh-k/duckduckgo 适用场景与选型建议

yanosh-k/duckduckgo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 39 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 yanosh-k/duckduckgo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yanosh-k/duckduckgo 我们能提供哪些服务?
定制开发 / 二次开发

基于 yanosh-k/duckduckgo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 39
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-02