V
V
Valery Zakharov2016-02-25 11:46:16
JavaScript
Valery Zakharov, 2016-02-25 11:46:16

Get links to Share-messages in social networks?

Wrote a simple script for share in social networks.

var Share = {
        vkontakte: function() {
            url  = 'http://vkontakte.ru/share.php?';
            url += 'url='          + encodeURIComponent(seo.purl);
            url += '&title='       + encodeURIComponent(seo.ptitle);
            url += '&description=' + encodeURIComponent(seo.text);
            url +=(seo.pimg!=''? '&image='       + encodeURIComponent(seo.pimg):'');
            url += '&noparse=true';
            Share.popup(url);
        },
        odnoklassniki: function() {
            url  = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1';
            url += '&st.comments=' + encodeURIComponent(seo.text);
            url += '&st._surl='    + encodeURIComponent(seo.purl);
            Share.popup(url);
        },
        facebook: function() {
            url  = 'http://www.facebook.com/sharer.php?m2w&s=100';
           // url += '&p[title]='     + encodeURIComponent(seo.ptitle);
            //url += '&p[summary]='   + encodeURIComponent(seo.text);
            url += '&p[url]='       + encodeURIComponent(seo.purl);
            url +=(seo.pimg!=''?'&p[images][0]=' + encodeURIComponent(seo.pimg):'');


            console.log(url);
            Share.popup(url);
        },
        twitter: function() {
            url  = 'http://twitter.com/share?';
            url += 'text='      + encodeURIComponent(seo.ptitle);
            url += '&url='      + encodeURIComponent( seo.purl);
            url += '&counturl=' + encodeURIComponent( seo.purl);
            Share.popup(url);
        },
        mailru: function() {
            url  = 'http://connect.mail.ru/share?';
            url += 'url='          + encodeURIComponent(seo.purl);
            url += '&title='       + encodeURIComponent(seo.ptitle);
            url += '&description=' + encodeURIComponent(seo.text);
            url +=(seo.pimg!=''? '&imageurl='    + encodeURIComponent(seo.pimg):'');
            Share.popup(url)
        },

        popup: function(url) {
            var pop = window.open(url,'','toolbar=0,status=0,width=626,height=436');

            pop.onunload = function(e) {
                alert('Please press the Logout button to logout.') ;
            };
            var oauthInterval = window.setInterval(function(){
                if (pop.closed) {
                    window.clearInterval(oauthInterval);
                    console.log('window closed');
                }
            }, 1000);
        }
    };
$(document).ready(function(){
    $('.share-fb').click(function(){ Share.facebook();return false;});
   $('.share-vk').click(function(){Share.vkontakte();return false;});
    $('.share-tw').click(function(){Share.twitter();return false; });
});

Posts are published, everything is fine, but there was a request from the customer: "how to get links to published posts?"
If with Twitter it was easy enough to use the search https://twitter.com/search?f=tweets&q=https://Isko... and everything is ok, then everything is sad with facebook and vkontakte.
Tell me how it is possible to find posts with an attached url?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-02-25
@thewind

Vkontakte has a search for posts with the mention of the desired url, right on their website.
Ps you did not write the script, but copied it from the Internet;) without changing anything directly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question