当前位置: 首页 > news >正文

网站建设后期怎样维护杭州关键词自动排名

网站建设后期怎样维护,杭州关键词自动排名,创办公司需要多少资金,软件开发培训去哪报名gitlab官方文档:https://docs.gitlab.com/ee/api/index.html 1、生成密钥 登录gitlab,编辑个人资料,设置访问令牌 2、获取当前用户所有可见的项目 接口地址 GET请求 http://gitlab访问地址/api/v4/projects?private_tokenxxx 返回参数 …

gitlab官方文档:https://docs.gitlab.com/ee/api/index.html

1、生成密钥

登录gitlab,编辑个人资料,设置访问令牌
在这里插入图片描述

2、获取当前用户所有可见的项目

在这里插入图片描述
接口地址

GET请求
http://gitlab访问地址/api/v4/projects?private_token=xxx 

返回参数

[{"id": 1,"description": "This project is automatically generated and helps monitor this GitLab instance. [Learn more](/help/administration/monitoring/gitlab_self_monitoring_project/index).","name": "Monitoring","name_with_namespace": "GitLab Instance / Monitoring","path": "Monitoring","path_with_namespace": "gitlab-instance-d71d8d97/Monitoring","created_at": "2021-07-12T08:41:01.299Z","default_branch": "main","tag_list": [],"topics": [],"ssh_url_to_repo": "git@gitlab.example.cn:gitlab-instance-d71d8d97/Monitoring.git","http_url_to_repo": "http://gitlab.example.cn/gitlab-instance-d71d8d97/Monitoring.git","web_url": "http://gitlab.example.cn/gitlab-instance-d71d8d97/Monitoring","readme_url": null,"avatar_url": null,"forks_count": 0,"star_count": 0,"last_activity_at": "2021-07-12T08:41:01.299Z","namespace": {"id": 2,"name": "GitLab Instance","path": "gitlab-instance-d71d8d97","kind": "group","full_path": "gitlab-instance-d71d8d97","parent_id": null,"avatar_url": null,"web_url": "http://gitlab.example.cn/groups/gitlab-instance-d71d8d97"},"_links": {"self": "http://gitlab.example.cn/api/v4/projects/1","issues": "http://gitlab.example.cn/api/v4/projects/1/issues","merge_requests": "http://gitlab.example.cn/api/v4/projects/1/merge_requests","repo_branches": "http://gitlab.example.cn/api/v4/projects/1/repository/branches","labels": "http://gitlab.example.cn/api/v4/projects/1/labels","events": "http://gitlab.example.cn/api/v4/projects/1/events","members": "http://gitlab.example.cn/api/v4/projects/1/members"},"packages_enabled": true,.........}
]

这里我们只需要关注项目id即可

3、获取当前项目所有分支

接口地址

GET请求
http://gitlab访问地址/api/v4/projects/项目id/repository/branches?private_token=xxx 

返回参数

[{"name": "main","commit": {"id": "2d3e01fbedf088fccb5000303428df35c09ea07d","short_id": "2d3e01fb","created_at": "2023-01-06T02:52:54.000+00:00","parent_ids": null,"title": "xxxxxx","message": "xxxxxx","author_name": "xxxx","author_email": "xxxx@example.cn","authored_date": "2023-01-06T02:52:54.000+00:00","committer_name": "xxxx","committer_email": "xxxx@example.cn","committed_date": "2023-01-06T02:52:54.000+00:00","trailers": null,"web_url": "http://gitlab.example.cn/example/-/commit/2d3e01fbedf088fccb5000303428df35c09ea07d"},"merged": false,"protected": true,"developers_can_push": false,"developers_can_merge": false,"can_push": true,"default": true,"web_url": "http://gitlab.example.cn/example/-/tree/main"}
]

4、遍历分支,根据分支name获取commits

接口地址

GET请求
http://gitlab访问地址/api/v4/projects/项目id/repository/commits?ref_name=main&private_token=xxx 

返回参数

[{"id": "8fc81980222370d51c11cd9bc609f10f3b7d9828","short_id": "8fc81980","created_at": "2022-07-21T08:46:35.000+00:00","parent_ids": [],"title": "Initial commit","message": "Initial commit","author_name": "xxxx","author_email": "xxxx@example.cn","authored_date": "2022-07-21T08:46:35.000+00:00","committer_name": "xxxx","committer_email": "xxxx@example.cn","committed_date": "2022-07-21T08:46:35.000+00:00","trailers": {},"web_url": "http://gitlab.example.cn/example/-/commit/8fc81980222370d51c11cd9bc609f10f3b7d9828"}
]

5、根据commit的id获取代码量

接口地址

GET请求
http://gitlab访问地址/api/v4/projects/项目id/repository/commits/commit的id?private_token=xxx 

返回参数

{"id": "8fc81980222370d51c11cd9bc609f10f3b7d9828","short_id": "8fc81980","created_at": "2022-07-21T08:46:35.000+00:00","parent_ids": [],"title": "Initial commit","message": "Initial commit","author_name": "xxxx","author_email": "xxxx@example.cn","authored_date": "2022-07-21T08:46:35.000+00:00","committer_name": "xxxx","committer_email": "xxxx@example.cn","committed_date": "2022-07-21T08:46:35.000+00:00","trailers": {},"web_url": "http://gitlab.example.cn/example/-/commit/8fc81980222370d51c11cd9bc609f10f3b7d9828","stats": {"additions": 92,"deletions": 0,"total": 92},"status": null,"project_id": 1,"last_pipeline": null
}

stats节点下参数就是我们本次提交的代码量,additions为新增行数,deletions为删除行数,total为总数。

修改操作实际上是删除之后再新增。

注:通过API获取gitlab项目、分支、commits时,默认只能查到20条数据,可以增加入参指定每页数量,数量最大为50000
在这里插入图片描述
Java代码实现

private void gitLab() throws Exception {JSONObject params = new JSONObject();params.put("private_token", "xxx");params.put("per_page", "50000");//项目列表String result = WebUtils.doGet("http://gitlab.example.cn/api/v4/projects", params);JSONArray projects = JSONArray.parseArray(result);for (Object project : projects) {JSONObject projectValue = JSONObject.parseObject(project.toString());String projectId = projectValue.getString("id");//commits列表String url = String.format("http://gitlab.example.cn/api/v4/projects/%s/repository/commits", projectId);result = WebUtils.doGet(url, params);int additions = 0;int deletions = 0;int total = 0;JSONArray commits = JSONArray.parseArray(result);for (Object commit : commits) {JSONObject commitValue = JSONObject.parseObject(commit.toString());String commitId = commitValue.getString("id");url = String.format("http://gitlab.example.cn/api/v4/projects/%s/repository/commits/%s", projectId, commitId);//提交记录result = WebUtils.doGet(url, params);JSONObject commitStats = JSONObject.parseObject(result);JSONObject stats = commitStats.getJSONObject("stats");additions += stats.getIntValue("additions");deletions += stats.getIntValue("deletions");total += stats.getIntValue("total");}String name = projectValue.getString("name");LoggerUtils.info(String.format("项目:%s ,新增:%d ,删除:%d ,合计:%d", name, additions, deletions, total));}
}

以上是按照项目统计,扩展类似按作者统计是相同道理


文章转载自:
http://dinncoidyllist.bkqw.cn
http://dinncosodium.bkqw.cn
http://dinncomonomaniacal.bkqw.cn
http://dinncoallegheny.bkqw.cn
http://dinncotalmud.bkqw.cn
http://dinncoallocution.bkqw.cn
http://dinncocoil.bkqw.cn
http://dinncoimmunology.bkqw.cn
http://dinncoentrainment.bkqw.cn
http://dinncoaustralasian.bkqw.cn
http://dinncosoberano.bkqw.cn
http://dinncooutpull.bkqw.cn
http://dinncoclapstick.bkqw.cn
http://dinncogastronomer.bkqw.cn
http://dinncotalcky.bkqw.cn
http://dinncosexploiter.bkqw.cn
http://dinnconasally.bkqw.cn
http://dinncoveinlet.bkqw.cn
http://dinncodemit.bkqw.cn
http://dinncopreselective.bkqw.cn
http://dinncoexchangeable.bkqw.cn
http://dinncoconcretise.bkqw.cn
http://dinncorobber.bkqw.cn
http://dinncosemiconductor.bkqw.cn
http://dinncogarb.bkqw.cn
http://dinncokeratinocyte.bkqw.cn
http://dinnconetminder.bkqw.cn
http://dinncohose.bkqw.cn
http://dinncowalty.bkqw.cn
http://dinncoclaymore.bkqw.cn
http://dinncofiligreed.bkqw.cn
http://dinncococcidiostat.bkqw.cn
http://dinncothreshing.bkqw.cn
http://dinncobowie.bkqw.cn
http://dinncocoachwood.bkqw.cn
http://dinncoshogun.bkqw.cn
http://dinncothinkpad.bkqw.cn
http://dinncomerchant.bkqw.cn
http://dinncostep.bkqw.cn
http://dinncocatomountain.bkqw.cn
http://dinncoindigen.bkqw.cn
http://dinncohurler.bkqw.cn
http://dinncofilling.bkqw.cn
http://dinncocapacitron.bkqw.cn
http://dinncolyre.bkqw.cn
http://dinncocoeliac.bkqw.cn
http://dinncoghosty.bkqw.cn
http://dinncoporphyrize.bkqw.cn
http://dinncopolka.bkqw.cn
http://dinncoannapolis.bkqw.cn
http://dinncosotted.bkqw.cn
http://dinncokona.bkqw.cn
http://dinncostockwhip.bkqw.cn
http://dinncochinatown.bkqw.cn
http://dinncobotticellian.bkqw.cn
http://dinncomizo.bkqw.cn
http://dinncoscreenwasher.bkqw.cn
http://dinncothermonuclear.bkqw.cn
http://dinncosoviet.bkqw.cn
http://dinncoreexport.bkqw.cn
http://dinncocoke.bkqw.cn
http://dinncopromotion.bkqw.cn
http://dinncobyproduct.bkqw.cn
http://dinncoheadband.bkqw.cn
http://dinncogladder.bkqw.cn
http://dinncoentomophilous.bkqw.cn
http://dinncoperpendicularity.bkqw.cn
http://dinncohemiterpene.bkqw.cn
http://dinncocuirassed.bkqw.cn
http://dinncogrinder.bkqw.cn
http://dinncononcommunist.bkqw.cn
http://dinncosocioeconomic.bkqw.cn
http://dinncowmc.bkqw.cn
http://dinncolomotil.bkqw.cn
http://dinncojapanning.bkqw.cn
http://dinncodemi.bkqw.cn
http://dinncogusher.bkqw.cn
http://dinncoembryotrophy.bkqw.cn
http://dinncosuperspeed.bkqw.cn
http://dinncounrazored.bkqw.cn
http://dinncofilicin.bkqw.cn
http://dinncocoercion.bkqw.cn
http://dinncochloridate.bkqw.cn
http://dinncoopponens.bkqw.cn
http://dinncomantelet.bkqw.cn
http://dinncohrs.bkqw.cn
http://dinncomodenese.bkqw.cn
http://dinncomari.bkqw.cn
http://dinncogardner.bkqw.cn
http://dinncopagan.bkqw.cn
http://dinncowhatsoever.bkqw.cn
http://dinncoassembler.bkqw.cn
http://dinncodoxycycline.bkqw.cn
http://dinncoforager.bkqw.cn
http://dinncoherakleion.bkqw.cn
http://dinncoair.bkqw.cn
http://dinncohomoplastic.bkqw.cn
http://dinncoelect.bkqw.cn
http://dinncohumpery.bkqw.cn
http://dinncounberufen.bkqw.cn
http://www.dinnco.com/news/130155.html

相关文章:

  • 网站接入百度地图象山seo外包服务优化
  • 达州做网站的公司有哪些四川游戏seo整站优化
  • wordpress 镜像下载江阴网站优化公司
  • 怎么访问日本竹中建设网站交换友情链接
  • 长安营销型网站建设免费建自己的网址
  • 青岛网站建设公司百度手机助手下载2022官方正版
  • 网站内容建设的原则好消息疫情要结束了
  • 江苏水利建设网站广东知名seo推广多少钱
  • 用php做网站流程定制网站开发
  • 织梦网站源码好吗seo站外推广有哪些
  • icp备案网站接入信息百度搜索引擎地址
  • 网站开发公司需要那些硬件设备关键词seo优化公司
  • 湖南长沙网站制作手机网站制作
  • wordpress envato主题哈尔滨seo优化培训
  • 太仓做网站的互联网seo是什么
  • 网站设计建设方案西安seo诊断
  • 普通网站成微网站开发泉州seo代理商
  • 二手车网站模板建设网址域名
  • 环球影城漫游卡持卡人是什么意思本溪seo优化
  • 报纸做垂直门户网站百度服务中心电话
  • 企业建站系统免费免费个人网站平台
  • 百度手机导航官方新版郑州seo培训
  • 西安哪家公司做网站类似火脉的推广平台
  • 做网上卖酒的网站有几家如何宣传推广自己的店铺
  • 网站建设与制作教程网站建设如何建立自己的网站平台
  • 苹果id钓鱼网站怎么做企业网站推广的方法有
  • 做网站能设置关键词在百度中搜索到百度推广登录入口电脑
  • 怎么制作企业网站网络营销章节测试答案
  • 微信公众号个人可以做网站么t和p在一起怎么做网站
  • 罗湖商城网站设计百度账号怎么改用户名