Twitter直接消息链接 - 将<button>转换为<a>

时间:2016-09-25 02:17:31

标签: javascript twitter converter href

If you log into twitter, and Direct Message is enabled, you'll see a "Send Message" button appear. I desire that URL. How do I get the URL for sending a specific user a DM? I dug into the code, and this is what we have. Thoughts?

Thanks in advance for your attention buddy.

This is what the button looks like:

enter image description here

如果你(R)点击&gt;这是(修剪过的)代码检查

`<button type="button" data-name="XYZABCTwitterName" data-screen-name="xyzabctwittername" data-user-id="4203234760" data-original-title="Send a Direct Message to XYZABCTwitterName">
  <span>
    <span>Message</span>
  </span>
</button>`

1 个答案:

答案 0 :(得分:-2)

这里有一个设置流程,引导您完成它

https://publish.twitter.com/

它会生成一个HTML链接和脚本标记以激活它。

<a href="https://twitter.com/messages/compose?recipient_id=realDonaldTrump" class="twitter-dm-button" data-screen-name="realDonaldTrump" data-show-count="false">Message @realDonaldTrump</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>