-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
添加 阿里巴巴、百度、今日头条 图床接口;删除已被封锁的 京东 图床接口;优化更新日期判断机制,给 pixiv 排行榜的奇葩更新机制擦屁股
- Loading branch information
mokeyjay
committed
Feb 6, 2020
1 parent
4580ac3
commit d71d69d
Showing
10 changed files
with
184 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace app\ImageHosting; | ||
|
||
use app\Libs\Curl; | ||
use app\Libs\Tools; | ||
|
||
/** | ||
* 阿里巴巴图床 | ||
* 鸣谢:[@metowolf](https://github.com/metowolf) | ||
* Class Alibaba | ||
* @package app\ImageHosting | ||
* @url https://www.alibaba.com/ | ||
*/ | ||
class Alibaba extends ImageHosting | ||
{ | ||
public function upload($path) | ||
{ | ||
$data = [ | ||
'file' => Curl::getCurlFile($path), | ||
'scene' => 'aeMessageCenterV2ImageRule', | ||
'name' => 'image.jpg' | ||
]; | ||
$result = Curl::post('https://kfupload.alibaba.com/mupload', $data, [ | ||
CURLOPT_USERAGENT => 'iAliexpress/6.22.1 (iPhone; iOS 12.1.2; Scale/2.00)', | ||
]); | ||
|
||
Tools::log('[阿里巴巴图床]上传:' . json_encode($data)); | ||
Tools::log('[阿里巴巴图床]返回:' . $result); | ||
|
||
$json = json_decode($result, true); | ||
if(isset($json['code']) && $json['code'] == 0 && isset($json['url'])){ | ||
return $json['url']; | ||
} | ||
|
||
Tools::log('[阿里巴巴图床]上传失败', 'ERROR'); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace app\ImageHosting; | ||
|
||
use app\Libs\Curl; | ||
use app\Libs\Tools; | ||
|
||
/** | ||
* 百度图床 | ||
* 鸣谢:[@metowolf](https://github.com/metowolf) | ||
* Class Baidu | ||
* @package app\ImageHosting | ||
* @url https://baijiahao.baidu.com/ | ||
*/ | ||
class Baidu extends ImageHosting | ||
{ | ||
public function upload($path) | ||
{ | ||
$data = [ | ||
'media' => Curl::getCurlFile($path), | ||
'no_compress' => '1', | ||
'id' => 'WU_FILE_0', | ||
'is_avatar' => '0', | ||
'type' => 'image', | ||
'name' => pathinfo($path, PATHINFO_FILENAME) . '.jpg' | ||
]; | ||
$result = Curl::post('https://baijiahao.baidu.com/builderinner/api/content/file/upload', $data, [ | ||
CURLOPT_HTTPHEADER => [ | ||
'Origin: https://baijiahao.baidu.com', | ||
'Referer: https://baijiahao.baidu.com/builder/app/register?type=individual' | ||
], | ||
]); | ||
|
||
Tools::log('[百度图床]上传:' . json_encode($data)); | ||
Tools::log('[百度图床]返回:' . $result); | ||
|
||
$json = json_decode($result, true); | ||
if(isset($json['errno']) && $json['errno'] == 0 && isset($json['ret']['org_url'])){ | ||
return $json['ret']['org_url']; | ||
} | ||
|
||
Tools::log('[百度图床]上传失败', 'ERROR'); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace app\ImageHosting; | ||
|
||
use app\Libs\Curl; | ||
use app\Libs\Tools; | ||
|
||
/** | ||
* 今日头条图床 | ||
* 鸣谢:[@metowolf](https://github.com/metowolf) | ||
* Class Toutiao | ||
* @package app\ImageHosting | ||
* @url https://mp.toutiao.com/ | ||
*/ | ||
class Toutiao extends ImageHosting | ||
{ | ||
public function upload($path) | ||
{ | ||
$data = [ | ||
'photo' => Curl::getCurlFile($path), | ||
]; | ||
$result = Curl::post('https://mp.toutiao.com/upload_photo/?type=json', $data, [ | ||
CURLOPT_HTTPHEADER => [ | ||
'Origin: https://mp.toutiao.com', | ||
'Referer: https://mp.toutiao.com/profile_register_v3/register/register-normal/2' | ||
], | ||
]); | ||
|
||
Tools::log('[今日头条图床]上传:' . json_encode($data)); | ||
Tools::log('[今日头条图床]返回:' . $result); | ||
|
||
$json = json_decode($result, true); | ||
if(isset($json['message']) && $json['message'] == 'success' && isset($json['web_url'])){ | ||
return $json['web_url']; | ||
} | ||
|
||
Tools::log('[今日头条图床]上传失败', 'ERROR'); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters