2

First time asking here, but after losing my head over this problem for the last days, I had to ask for your help. Basically I need to create the classic social media buttons on a German site, and XING is quite popular there, so I need to do it for it too.

For this project there also needs to be a working counter of the number of shares/likes, and that wasn't a problem for Facebook and Twitter, I just used jQuery to get JSON from graph.facebook.com and urls.api.twitter.com, but XING doesn't seem to have something like that!

On their site they do offer a pre-built Share button just like the others do, and that one has a share counter, but I need to use my custom design.

I even tried to get that default button, hide it and grab the share-counter value to use in my button, but without success, it gives me either UNDEFINED or just nothing.

But I know there must be a way to do it because, for instance, this site does have a working share-counter for XING with a custom style: http://t3n.de/news/recht-homeoffice-620969/

Do you guys have any idea on what I should try?

4

1 回答 1

0

我终于设法通过解析来自 xing 共享小部件的 html 代码并从气泡中获取数字来做到这一点。(您必须在服务器端执行此操作)。

这是按钮 + 计数的网址:

https://www.xing-share.com/app/share?op=get_share_button;counter=top;url=your_url_here

您应该能够在上述链接返回的 html 上使用以下正则表达式获取计数:

xing-count(.+?)(\d+)(.*?)</span>

第二个匹配将包含共享计数。

于 2015-07-10T06:25:08.267 回答