zoukankan      html  css  js  c++  java
  • 个人实用api

    单机勿压

    1、 查地理位置的经纬度(geocoder)

      tips: 高德地图api 只能查国内的地址。google 地图使用一段时间会收费。本接口的原理:https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/utils/geocoder?hl=zh_CN#q%3D%25u4EAC   【需要FQ,google 地图】(技术的都懂哈)

      POST: http://128.14.132.26:9527/api/geocoder?address=北京市   (例如北京)

      结果返回: 

    {
        "results": [
            {
                "address_components": [
                    {
                        "long_name": "Beijing",
                        "short_name": "Beijing",
                        "types": [
                            "locality",
                            "political"
                        ]
                    },
                    {
                        "long_name": "Beijing",
                        "short_name": "Beijing",
                        "types": [
                            "administrative_area_level_1",
                            "political"
                        ]
                    },
                    {
                        "long_name": "China",
                        "short_name": "CN",
                        "types": [
                            "country",
                            "political"
                        ]
                    }
                ],
                "formatted_address": "Beijing, China",
                "geometry": {
                    "bounds": {
                        "northeast": {
                            "lat": 41.060816,
                            "lng": 117.514625
                        },
                        "southwest": {
                            "lat": 39.442758,
                            "lng": 115.423411
                        }
                    },
                    "location": {
                        "lat": 39.9042,
                        "lng": 116.407396
                    },
                    "location_type": "APPROXIMATE",
                    "viewport": {
                        "northeast": {
                            "lat": 40.216496,
                            "lng": 116.782984
                        },
                        "southwest": {
                            "lat": 39.661271,
                            "lng": 116.011934
                        }
                    }
                },
                "place_id": "ChIJuSwU55ZS8DURiqkPryBWYrk",
                "types": [
                    "locality",
                    "political"
                ]
            }
        ],
        "status": "ok"
    }
    

    2、google 翻译api

      tips: api 的原理见:https://translate.google.cn/?sl=auto&tl=en&op=translate  .这里使用模拟的方式进行翻译。这里主要支持了数组的翻译。整篇文章的翻译,自觉绕道去官网上复制粘贴吧。

      POST:  requests.post("http://128.14.132.26:9527/api/translate",json={"source_lang":"auto","target_lang":"en","need_trans":[]})       。要求每个元素不超过5k 个 unicode 字符。

      source_lang 参数见:官网sl 参数。target_lang参数见:官网tl 参数。need_trans里面需要传输一个List[str]。

      技术要点:官网中的输入框不能一个字符一个字符的敲击,这样会把浏览器搞死的【估计是监听了input 事件,每敲击一次都会进行翻译的】。大批量的翻译,只能使用复制粘贴的方式。

      比如实现方式如下:

      

      结果返回:

    {
        'data': ['China Airlines three times', 'PR three 01', 'PR three 02', 'China Airlines 3 03', 'Dragon control 02 excellent', 'Dragon control 02 times', '18 Guijin MTN001', 'Contemporary 03 excellent', '08 Shaanxi Defense', '19 votes 01', '10 Shaanxi Defense', '12 gold', '12 green rain 01', '12 Shen Wanfubble', '13 heteral titanium 01', '13 Jinhui 01', '13 Baishi debt', '13 can build MTN1 in 13', '13-day debt', '13 Jinhai 01'],
        'message': 'ok',
        'type': 'info'
    }

    持续更新中。。。

  • 相关阅读:
    Everything
    图片在下载过程中由模糊逐渐变清晰的技巧
    Windows下Critical Section、Event、Mutex、Semaphores区别
    二维Cookie操作(JS和ASP)
    ASP.net利用urlMappings重写URL路径(URL映射)
    GHOST (以硬盘为单位和以分区分区为单位还原)>个人观点:)
    简单计算器
    ASP操作COOKIE
    擦亮自己的眼睛去看SQLServer之谈谈锁机制
    SQL SERVER2008跟踪标志
  • 原文地址:https://www.cnblogs.com/xunhanliu/p/14378392.html
Copyright © 2011-2022 走看看