ngpp/nikeplusexport

此包已被弃用,不再维护。未建议替代包。

导出您的Nike+ gps活动

1.1.1 2015-06-23 00:53 UTC

This package is not auto-updated.

Last update: 2021-02-19 20:48:58 UTC


README

此仓库不再维护,并且脚本可能已经无法正常工作,因为Nike+PHP已停止服务

关于

NikePlusExport是一个脚本,用于帮助您导出您的Nike+ gps活动。
该脚本支持JSON、GPX和TCX作为输出格式。
本项目主要受到https://gist.github.com/3121560的启发。

此脚本不使用nike+ api来检索活动。

需求

此脚本基于优秀的Nike+PHP http://nikeplusphp.org/
已经成功与nikeplusphp.4.5.php进行过测试。
为了正确运行,需要PHP 5、cURL和JSON。

安装

简单地运行,假设您已安装composer.phar或composer二进制文件

$ composer require ngpp/nikeplusexport

示例

以下是导出所有跑步代码的示例

#!php
<?php
    //Creates the object
    $n = new \Nike\Export($username, $password);
    foreach ($n->activities() as $activity)
    {
        if ($activity->gps)
        {
            //Activities need to be loaded one by one to get the gps data
            $activity = $n->activity($activity->activityId)->activity;
            //Create JSON file
            if(!is_null($jsonContent = $n->toJSON($activity)))
            {
                file_put_contents($activity->activityId . '.json', $jsonContent);
            }
            //Create GPX file
            if(!is_null($gpxContent = $n->toGPX($activity)))
            {
                file_put_contents($activity->activityId . '.gpx', $gpxContent);
            }
            //Create TCX file
            if(!is_null($tcxContent = $n->toTCX($activity)))
            {
                file_put_contents($activity->activityId . '.tcx', $tcxContent);
            }
        }
    }

信息和联系

脚本输出的格式遵循以下实现

Nike+应用程序存储的GPS数据不包含时间。时间已计算,可能无法完全准确。

如果您在使用脚本时遇到任何问题或希望看到新功能,请发送电子邮件至nikeplusexport@guelpa.me