forked from bradvin/social-share-urls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
social-share-media.pl
161 lines (149 loc) · 6.33 KB
/
social-share-media.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package SocialShareMedia::SocialShareURLs;
use HTML::Entities;
use strict;
sub GetSocialMediaSites_NiceNames {
return [
'add.this'=>'AddThis',
'blogger'=>'Blogger',
'buffer'=>'Buffer',
'diaspora'=>'Diaspora',
'douban'=>'Douban',
'email'=>'EMail',
'evernote'=>'EverNote',
'getpocket'=>'Pocket',
'facebook'=>'FaceBook',
'flattr'=>'Flattr',
'flipboard'=>'FlipBoard',
'google.bookmarks'=>'GoogleBookmarks',
'instapaper'=>'InstaPaper',
'line.me'=>'Line.me',
'linkedin'=>'LinkedIn',
'livejournal'=>'LiveJournal',
'gmail'=>'GMail',
'hacker.news'=>'HackerNews',
'ok.ru'=>'OK.ru',
'pinterest'=>'Pinterest',
'qzone'=>'QZone',
'reddit'=>'Reddit',
'renren'=>'RenRen',
'skype'=>'Skype',
'sms'=>'SMS',
'surfingbird.ru'=>'SurfingBird.ru',
'telegram.me'=>'Telegram.me',
'threema'=>'Threema',
'tumblr'=>'Tumblr',
'twitter'=>'Twitter',
'vk'=>'VK',
'weibo'=>'Weibo',
'whatsapp'=>'WhatsApp',
'xing'=>'Xing',
'yahoo'=>'Yahoo',
];
}
sub GetSocialMediaSites_WithShareLinks_OrderedByPopularity {
return [
'google.bookmarks',
'facebook',
'reddit',
'whatsapp',
'twitter',
'linkedin',
'tumblr',
'pinterest',
'blogger',
'livejournal',
'evernote',
'add.this',
'getpocket',
'hacker.news',
'buffer',
'flipboard',
'instapaper',
'surfingbird.ru',
'flattr',
'diaspora',
'qzone',
'vk',
'weibo',
'ok.ru',
'douban',
'xing',
'renren',
'threema',
'sms',
'line.me',
'skype',
'telegram.me',
'email',
'gmail',
'yahoo',
];
}
sub GetSocialMediaSites_WithShareLinks_OrderedByAlphabet {
my ($self, $args) = @_;
my $nice_names = $self->GetSocialMediaSites_NiceNames();
return keys %$nice_names;
}
# Social Media Site Links With Share Links
# -------------------------------------------------
sub GetSocialMediaSiteLinks_WithShareLinks {
my ($self, $args) = @_;
my $url = HTML::Entities::decode_entities($args->{url});
my $title = HTML::Entities::decode_entities($args->{title});
my $image = HTML::Entities::decode_entities($args->{image});
my $desc = HTML::Entities::decode_entities($args->{desc});
my $app_id = HTML::Entities::decode_entities($args->{appid});
my $redirect_url = HTML::Entities::decode_entities($args->{redirecturl});
my $via = HTML::Entities::decode_entities($args->{via});
my $hash_tags = HTML::Entities::decode_entities($args->{hashtags});
my $provider = HTML::Entities::decode_entities($args->{provider});
my $language = HTML::Entities::decode_entities($args->{language});
my $user_id = HTML::Entities::decode_entities($args->{userid});
my $category = HTML::Entities::decode_entities($args->{category});
my $phone_number = HTML::Entities::decode_entities($args->{phonenumber});
my $email_address = HTML::Entities::decode_entities($args->{emailaddress});
my $cc_email_address = HTML::Entities::decode_entities($args->{ccemailaddress});
my $bcc_email_address = HTML::Entities::decode_entities($args->{bccemailaddress});
my $text = $title;
if($desc) {
$text .= '%20%3A%20'; # This is just this, " : "
$text .= $desc;
}
return {
'add.this'=>'http://www.addthis.com/bookmark.php?url=' . $url,
'blogger'=>'https://www.blogger.com/blog-this.g?u=' . $url . '&n=' . $title . '&t=' . $desc,
'buffer'=>'https://buffer.com/add?text=' . $text . '&url=' . $url,
'diaspora'=>'https://share.diasporafoundation.org/?title=' . $title . '&url=' . $url,
'douban'=>'http://www.douban.com/recommend/?url=' . $url . '&title=' . $text,
'email'=>'mailto:' . $email_address . '?subject=' . $title . '&body=' . $desc,
'evernote'=>'https://www.evernote.com/clip.action?url=' . $url . '&title=' . $text,
'getpocket'=>'https://getpocket.com/edit?url=' . $url,
'facebook'=>'http://www.facebook.com/sharer.php?u=' . $url,
'flattr'=>'https://flattr.com/submit/auto?user_id=' . $user_id . '&url=' . $url . '&title=' . $title . '&description=' . $text . '&language=' . $language . '&tags=' . $hash_tags . '&hidden=HIDDEN&category=' . $category,
'flipboard'=>'https://share.flipboard.com/bookmarklet/popout?v=2&title=' . $text . '&url=' . $url,
'gmail'=>'https://mail.google.com/mail/?view=cm&to=' . $email_address . '&su=' . $title . '&body=' . $url . '&bcc=' . $bcc_email_address . '&cc=' . $cc_email_address,
'google.bookmarks'=>'https://www.google.com/bookmarks/mark?op=edit&bkmk=' . $url . '&title=' . $title . '&annotation=' . $text . '&labels=' . $hash_tags . '',
'instapaper'=>'http://www.instapaper.com/edit?url=' . $url . '&title=' . $title . '&description=' . $desc,
'line.me'=>'https://lineit.line.me/share/ui?url=' . $url . '&text=' . $text,
'linkedin'=>'https://www.linkedin.com/sharing/share-offsite/?url=' . $url,
'livejournal'=>'http://www.livejournal.com/update.bml?subject=' . $text . '&event=' . $url,
'hacker.news'=>'https://news.ycombinator.com/submitlink?u=' . $url . '&t=' . $title,
'ok.ru'=>'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=' . $url,
'pinterest'=>'http://pinterest.com/pin/create/button/?url=' . $url ,
'qzone'=>'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' . $url,
'reddit'=>'https://reddit.com/submit?url=' . $url . '&title=' . $title,
'renren'=>'http://widget.renren.com/dialog/share?resourceUrl=' . $url . '&srcUrl=' . $url . '&title=' . $text . '&description=' . $desc,
'skype'=>'https://web.skype.com/share?url=' . $url . '&text=' . $text,
'sms'=>'sms:' . $phone_number . '?body=' . $text,
'surfingbird.ru'=>'http://surfingbird.ru/share?url=' . $url . '&description=' . $desc . '&screenshot=' . $image . '&title=' . $title,
'telegram.me'=>'https://t.me/share/url?url=' . $url . '&text=' . $text . '&to=' . $phone_number,
'threema'=>'threema://compose?text=' . $text . '&id=' . $user_id,
'tumblr'=>'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' . $url . '&title=' . $title . '&caption=' . $desc . '&tags=' . $hash_tags,
'twitter'=>'https://twitter.com/intent/tweet?url=' . $url . '&text=' . $text . '&via=' . $via . '&hashtags=' . $hash_tags,
'vk'=>'http://vk.com/share.php?url=' . $url . '&title=' . $title . '&comment=' . $desc,
'weibo'=>'http://service.weibo.com/share/share.php?url=' . $url . '&appkey=&title=' . $title . '&pic=&ralateUid=',
'whatsapp'=>'https://api.whatsapp.com/send?text=' . $text . '%20' . $url,
'xing'=>'https://www.xing.com/spi/shares/new?url=' . $url,
'yahoo'=>'http://compose.mail.yahoo.com/?to=' . $email_address . '&subject=' . $title . '&body=' . $text,
};
}