{"id":19283173,"url":"https://github.com/sqlsec/imghosting","last_synced_at":"2025-11-15T10:29:12.967Z","repository":{"id":112977442,"uuid":"139804459","full_name":"sqlsec/imgHosting","owner":"sqlsec","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-17T09:41:02.000Z","size":580,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-23T22:30:03.222Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sqlsec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-05T06:26:47.000Z","updated_at":"2020-03-11T14:13:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"7196dcef-38ba-44b9-a668-912b78c7e83e","html_url":"https://github.com/sqlsec/imgHosting","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sqlsec/imgHosting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlsec%2FimgHosting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlsec%2FimgHosting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlsec%2FimgHosting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlsec%2FimgHosting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqlsec","download_url":"https://codeload.github.com/sqlsec/imgHosting/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlsec%2FimgHosting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284545265,"owners_count":27023524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-15T02:00:06.050Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T21:30:00.319Z","updated_at":"2025-11-15T10:29:12.950Z","avatar_url":"https://github.com/sqlsec.png","language":"Python","readme":"# imgHosting\n\n## 开发使用说明\n\n### 开发环境\n\n\n依赖`pipenv`管理,具体安装参见[pipenv#installation](https://github.com/pypa/pipenv#installation)。\n\n\n安装pipenv之后, 进入项目根目录（含有Pipfile文件目录），\n\n \n\n执行以下命令，安装`imgHosting`到本地环境。\n\n```shell\n\npipenv install --skip-lock\n\npipenv install '-e .' --dev --skip-lock\n\n```\n\n进入虚拟环境\n\n```shell\n\npipenv shell\n\n```\n\n测试：\n\n```shell\n\npython imgHosting/uploads/GroupJD_0001.py -f imgHosting/uploads/test.png\n\n```\n\n \n\n### uploads编写\n\n \n\n在`uploads`目录下，新建文件：\n\n \n\n例如`GroupJD_0001.py`:\n\n \n\n首先导入相关接口：\n\n```python\n\nfrom imgHosting import FreeimgUpLoad\n\n \n\nimport requests\n\n```\n\n定义Upload类继承FreeimgUpLoad\n\n \n\n```python\n\nclass Upload(FreeimgUpLoad):\n\n \n\n    def __init__(self):\n\n        super(Upload, self).__init__()\n\n        # \u003c上传点的名称\u003e **(唯一的)\n\n        self.name = \"京东论坛上传点\"\n\n        # \u003c作者\u003e\n\n        self.author = \"author\"\n\n        # \u003c是否支持gif上传\u003e (True|False)\n\n        self.isUploadGif = True|False\n\n \n\n        # \u003c图片上传限制 单位字节\u003e (数字|或者数字相乘)\n\n        self.maxsize = 10*1024*1024\n\n \n\n    def upimag(self):\n\n        # \u003c上传的代码\u003e\n\n        # \u003c方法只返回图片的url\u003e\n\n```\n\n下面看一下`GroupJD_0001.py`的`upimag`方法:\n\n \n\n\u003e `self.target`会获取运行时`-f`指定的图片。\n\n \n\n```python\n\ntry:\n\n    with open(self.target, 'rb') as file:\n\n        url = 'https://group.jd.com/ueditor/jsp/imageUp.jsp?action=uploadimage\u0026encode=utf-8'\n\n        headers = {\n\n            'Host': 'group.jd.com',\n\n            'Origin': 'https://group.jd.com',\n\n            'Referer': 'https://group.jd.com/ueditor/dialogs/imag',\n\n            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36',   \n\n        }\n\n        response = requests.post(url, headers=headers,files={'upfile':file})\n\n        return 'http://img30.360buyimg.com/club_community/'+response.json()['url']\n\nexcept Exception as e:\n\n    return \"获取图片失败.错误信息:{0}\".format(e)\n\n```\n\n`run()`会解析命令行参数 -f 到 target 中等，详细看(`imgHosting/imgHosting/lib/base.py` 的`run`方法)\n\n```python\n\nif __name__ == '__main__':\n\n    Upload().run()\n\n```\n\n \n\n---\n\n## webApp使用说明\n\n\u003e 考虑到命令行不太友好，故想搞个web端(之后想封装到docker下)\n\n \n\n### 功能演示：\n\n\u003e 推荐用`chrome`打开...\n\n![](http://image.3001.net/images/20180713/15314706717377.gif)\n\n \n\n### 简单说一下细节\n\n\u003e 页面写很烂...前段知识匮乏…导致拖了些时间... o(╥﹏╥)o\n\n \n\n- 前段:`bootstrap`\n\n- web框架:`flask`\n\n- 数据库:`sqllite`\n\n \n\n### 如何使用\n\n \n\n- 进入虚拟环境 \n\n看上面进入`开发使用说明/开发环境`👆👆👆\n\n\n- 同步数据\n\n\u003e 将imghosting/uploads 下的上传脚本录入数据库\n\n```shell\ncd webapp\npython sync.py # 目前只写重新录入功能，更新没有写\n```\n- 运行\n\n```shel\npython View.py\n```\n\n在浏览器(推荐chrome)打开 http://localhost:5000/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlsec%2Fimghosting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqlsec%2Fimghosting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlsec%2Fimghosting/lists"}