binsee / padchat-sdk

padchat项目,sdk开发包,提供直接对协议服务的对接。本项目已停止维护,请转向新方案 https://github.com/botorange/wechaty-puppet-padpro
260 stars 88 forks source link

发送朋友圈带图片需要TimelineObject但是文档没有定义需要哪些参数 #102

Closed Cphilo closed 5 years ago

Cphilo commented 5 years ago

你好,因为需要自动发送带图片的朋友圈,但是sdk api发现只是简单说了给出来TimelineObject,但是具体需要哪些参数没有定义,这边对于这个不是很清楚怎么使用,是不是可以针对图片这部分单独给出来下参数说明 image

binsee commented 5 years ago

自行抓取现有数据并组装结构

binsee commented 5 years ago

示例

<Timelineobject><id></id><username>wxid_xxxx</username><contentDesc>来自代码发的朋友圈</contentDesc><contentDescShowType>0</contentDescShowType><contentDescScene>3</contentDescScene><private>0</private><sightFolded>0</sightFolded><appInfo><id></id><version></version><appName></appName><installUrl></installUrl><fromUrl></fromUrl><isForceUpdate>0</isForceUpdate></appInfo><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><statExtStr></statExtStr><Contentobject><contentStyle>1</contentStyle><title></title><description></description><mediaList><media><id>12820843752265551969</id><type>2</type><title></title><description></description><private>0</private><url type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/0]]></url><thumb type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/150]]></thumb><size height="1556.0" width="1080.0" totalSize="92689.0"></size></media></mediaList><contentUrl></contentUrl></Contentobject><actionInfo><appMsg><messageAction></messageAction></appMsg></actionInfo><location poiClassifyId="" poiName="" poiAddress="" poiClassifyType="0" city=""></location><publicUserName></publicUserName><streamvideo><streamvideourl></streamvideourl><streamvideothumburl></streamvideothumburl><streamvideoweburl></streamvideoweburl></streamvideo></Timelineobject>
Cphilo commented 5 years ago

你好,这个示例我确实看过了,但是因为我这边没法直接用换上自己这边的数据就还是不行,会返回{"success":false,"data":{}},我这边的示例数据是:

[2019-05-10T15:58:42.884] [INFO] app - <TimelineObject><username>wxid_d5pbthavashi22</username><contentDesc>测试更改文字</contentDesc><contentDescShowType>0</contentDescShowType><contentDescScene>3</contentDescScene><private>0</private><sightFolded>0</sightFolded><showFlag>0</showFlag><appInfo><isForceUpdate>0</isForceUpdate></appInfo><ContentObject><contentStyle>1</contentStyle><mediaList><media><type>2</type><private>0</private><subType>0</subType><url type="1" videomd5="">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljbaKBnOibkBvY9gRcN2lLpFx/0</url><thumb type="1">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljbaKBnOibkBvY9gRcN2lLpFx/150</thumb><size width="758" height="758" totalSize="0"/><description>测试更改文字</description></media><media><type>2</type><private>0</private><subType>0</subType><url type="1" videomd5="">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljaYNoBJcMeaPibvZZsHL7Hich/0</url><thumb type="1">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljaYNoBJcMeaPibvZZsHL7Hich/150</thumb><size width="1020" height="1020" totalSize="0"/></media><media><type>2</type><private>0</private><subType>0</subType><url type="1" videomd5="">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljYulfajZGhS2zTQslXa6xia5/0</url><thumb type="1">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljYulfajZGhS2zTQslXa6xia5/150</thumb><size width="1020" height="1020" totalSize="0"/></media><media><type>2</type><private>0</private><subType>0</subType><url type="1" videomd5="">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljY60GNacaibD3kia2tu4L1K9C/0</url><thumb type="1">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljY60GNacaibD3kia2tu4L1K9C/150</thumb><size width="1020" height="1020" totalSize="0"/></media><media><type>2</type><private>0</private><subType>0</subType><url type="1" videomd5="">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljZmZegQWkGXjnHoiaorQ1jLG/0</url><thumb type="1">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljZmZegQWkGXjnHoiaorQ1jLG/150</thumb><size width="900" height="1200" totalSize="0"/></media><media><type>2</type><private>0</private><subType>0</subType><url type="1" videomd5="">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljbaiayvvXvh6vwohztIAkMpn/0</url><thumb type="1">http://mmsns.qpic.cn/mmsns/PiajxSqBRaELmh6118cO049xwnCEZwuiby3ziaQFxCZljbaiayvvXvh6vwohztIAkMpn/150</thumb><size width="858" height="846" totalSize="0"/></media></mediaList></ContentObject></TimelineObject>
[2019-05-10T15:58:42.934] [INFO] app - {"success":false,"data":{}}
binsee commented 5 years ago

我上边发的示例,只修改username字段发一下试试。这段是我以前测试时使用正常的,你使用的和示例的字段有差异

Cphilo commented 5 years ago

@binsee 嗯,我就是改了username然后试的发现不行了

Cphilo commented 5 years ago

有时间你可以本地再试下?

binsee commented 5 years ago

测试过了,正常。

[2019-05-10T16:33:53.363] [INFO] app - 执行函数 snsSendMoment,参数: [ '<TimelineObject><id>0</id><username>wxid_xxx</username><createTime>0</createT
ime><contentDescShowType>0</contentDescShowType><contentDescScene>0</contentDescScene><private>0</private><contentDesc><![CDATA[代码测试]]></contentDe
sc><contentattr><![CDATA[0]]></contentattr><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><weappInfo><appUserName></appUserName><pagePath></pagePath></weappInfo><canvasInfoXml></canvasInfoXml><ContentObject><contentStyle><![CDATA[1]]></contentStyle><contentSubStyle><![CDATA[0]]></contentSubStyle><title></title><description></description><contentUrl></contentUrl><mediaList><media><id><![CDATA[12820843752265551969]]></id><type><![CDATA[2]]></type><title></title><description></description><private><![CDATA[0]]></private><url type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/0]]></url><thumb type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/150]]></thumb><size height="1556.0" width="1080.0" totalSize="92689.0"></size></media><media><id><![CDATA[12820843752265551969]]></id><type><![CDATA[2]]></type><title></title><description></description><private><![CDATA[0]]></private><url type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/0]]></url><thumb type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/150]]></thumb><size height="1556.0" width="1080.0" totalSize="92689.0"></size></media></mediaList></ContentObject></TimelineObject>' ]
[2019-05-10T16:33:53.894] [INFO] app - 执行函数 snsSendMoment 结果:{ success: true,
  data:
   { data:
      { description:
         '<TimelineObject><id>13065065992526770348</id><username>wxid_xxxxxxxxxx</username><createTime>1557477234</createTime><contentDescShowType>0</contentDescShowType><contentDescScene>0</contentDescScene><private>0</private><contentDesc><![CDATA[代码测试]]></contentDesc><contentattr><![CDATA
[0]]></contentattr><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><weappInfo><appUserName></appUserName><pagePath></pagePath></weappInfo><canvasInfoXml></canvasInfoXml><ContentObject><contentStyle><![CDATA[1]]></contentStyle><contentSubStyle><![CDATA[0]]></contentSubStyle><title></title><description></description><contentUrl></contentUrl><mediaList><media><id><![CDATA[13065065993072554162]]></id><type><![CDATA[2]]></type><title></title><description></description><private><![CDATA[0]]></private><url type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/0]]></url><thumb type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/150]]></thumb><size height="1556.0" width="1080.0" totalSize="92689.0"></size></media><media><id><![CDATA[13065065993132716199]]></id><type><![CDATA[2]]></type><title></title><description></description><private><![CDATA[0]]></private><url type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/0]]></url><thumb type="1"><![CDATA[http://shmmsns.qpic.cn/mmsns/LXqicVqwJiatoiaicILBibYK2IpcMZVIbBKQw8ibTXCW0TWw38I9icwhjiaZp1lO33j3SNibScRE5bybXtxU/150]]></thumb><size height="1556.0" width="1080.0" totalSize="92689.0"></size></media></mediaList></ContentObject><appInfo><id></id></appInfo><actionInfo><appMsg><messageAction></messageAction></appMsg></actionInfo><location poiClassifyId="" poiName="" poiAddress="" poiClassifyType="0" city=""></location><publicUserName></publicUserName><streamvideo><streamvideourl></streamvideourl><streamvideothumburl></streamvideothumburl><streamvideoweburl></streamvideoweburl></streamvideo><showFlag></showFlag></TimelineObject>',
        id: '13065065992526770348',
        createTime: 1557477235,
        nickName: '杉木.不语',
        userName: 'wxid_xxxxxxxxxx' },
     message: '',
     status: 0 } }

image

Cphilo commented 5 years ago

你好,我问下那个media元素的那个id是哪里来的?12820843752265551969

binsee commented 5 years ago

你随便填一个数值,不要为空就行

Cphilo commented 5 years ago

嗯,问题解决了,主要那个<![CDATA[代码测试]]>可以改成代码测试