-
Notifications
You must be signed in to change notification settings - Fork 309
/
Copy pathSocialMedia.py
166 lines (156 loc) · 7.63 KB
/
SocialMedia.py
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
162
163
164
165
166
class SocialMedia:
def __init__(self):
pass
def GetSocialMediaSites_NiceNames(self):
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',
}
def GetSocialMediaSites_WithShareLinks_OrderedByPopularity(self):
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',
]
def GetSocialMediaSites_WithShareLinks_OrderedByAlphabet(self):
socialmediasites = self.GetSocialMediaSites_NiceNames().keys()
socialmediasites.sort()
return socialmediasites
def GetSocialMediaSiteLinks_WithShareLinks(self, args):
safeargs = [
'url',
'title',
'image',
'desc',
'appid',
'redirecturl',
'via',
'hash_tags',
'provider',
'language',
'user_id',
'category',
'phone_number',
'email_address',
'cc_email_address',
'bcc_email_address',
]
for safearg in safeargs:
if not args.get(safearg):
args[safearg] = ''
text = args['title']
if len(args['desc']):
text += '%20%3A%20' + args['desc']
return {
'add.this':'http://www.addthis.com/bookmark.php?url=' + args['url'],
'blogger':'https://www.blogger.com/blog-this.g?u=' + args['url'] + '&n=' + args['title'] + '&t=' + args['desc'],
'buffer':'https://buffer.com/add?text=' + text + '&url=' + args['url'],
'diaspora':'https://share.diasporafoundation.org/?title=' + args['title'] + '&url=' + args['url'],
'douban':'http://www.douban.com/recommend/?url=' + args['url'] + '&title=' + text,
'email':'mailto:' + args['email_address'] + '?subject=' + args['title'] + '&body=' + args['desc'],
'evernote':'https://www.evernote.com/clip.action?url=' + args['url'] + '&title=' + text,
'getpocket':'https://getpocket.com/edit?url=' + args['url'],
'facebook':'http://www.facebook.com/sharer.php?u=' + args['url'],
'flattr':'https://flattr.com/submit/auto?user_id=' + args['user_id'] + '&url=' + args['url'] + '&title=' + args['title'] + '&description=' + text + '&language=' + args['language'] + '&tags=' + args['hash_tags'] + '&hidden=HIDDEN&category=' + args['category'],
'flipboard':'https://share.flipboard.com/bookmarklet/popout?v=2&title=' + text + '&url=' + args['url'],
'gmail':'https://mail.google.com/mail/?view=cm&to=' + args['email_address'] + '&su=' + args['title'] + '&body=' + args['url'] + '&bcc=' + args['bcc_email_address'] + '&cc=' + args['cc_email_address'],
'google.bookmarks':'https://www.google.com/bookmarks/mark?op=edit&bkmk=' + args['url'] + '&title=' + args['title'] + '&annotation=' + text + '&labels=' + args['hash_tags'] + '',
'instapaper':'http://www.instapaper.com/edit?url=' + args['url'] + '&title=' + args['title'] + '&description=' + args['desc'],
'line.me':'https://lineit.line.me/share/ui?url=' + args['url'] + '&text=' + text,
'linkedin':'https://www.linkedin.com/sharing/share-offsite/?url=' + args['url'],
'livejournal':'http://www.livejournal.com/update.bml?subject=' + text + '&event=' + args['url'],
'hacker.news':'https://news.ycombinator.com/submitlink?u=' + args['url'] + '&t=' + args['title'],
'ok.ru':'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=' + args['url'],
'pinterest':'http://pinterest.com/pin/create/button/?url=' + args['url'] ,
'qzone':'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + args['url'],
'reddit':'https://reddit.com/submit?url=' + args['url'] + '&title=' + args['title'],
'renren':'http://widget.renren.com/dialog/share?resourceUrl=' + args['url'] + '&srcUrl=' + args['url'] + '&title=' + text + '&description=' + args['desc'],
'skype':'https://web.skype.com/share?url=' + args['url'] + '&text=' + text,
'sms':'sms:' + args['phone_number'] + '?body=' + text,
'surfingbird.ru':'http://surfingbird.ru/share?url=' + args['url'] + '&description=' + args['desc'] + '&screenshot=' + args['image'] + '&title=' + args['title'],
'telegram.me':'https://t.me/share/url?url=' + args['url'] + '&text=' + text + '&to=' + args['phone_number'],
'threema':'threema://compose?text=' + text + '&id=' + args['user_id'],
'tumblr':'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' + args['url'] + '&title=' + args['title'] + '&caption=' + args['desc'] + '&tags=' + args['hash_tags'],
'twitter':'https://twitter.com/intent/tweet?url=' + args['url'] + '&text=' + text + '&via=' + args['via'] + '&hashtags=' + args['hash_tags'],
'vk':'http://vk.com/share.php?url=' + args['url'] + '&title=' + args['title'] + '&comment=' + args['desc'],
'weibo':'http://service.weibo.com/share/share.php?url=' + args['url'] + '&appkey=&title=' + args['title'] + '&pic=&ralateUid=',
'whatsapp':'https://api.whatsapp.com/send?text=' + text + '%20' + args['url'],
'xing':'https://www.xing.com/spi/shares/new?url=' + args['url'],
'yahoo':'http://compose.mail.yahoo.com/?to=' + args['email_address'] + '&subject=' + args['title'] + '&body=' + text,
}
sm = SocialMedia()
#socialmediasites = sm.GetSocialMediaSites_WithShareLinks_OrderedByAlphabet()
socialmediasites = sm.GetSocialMediaSites_WithShareLinks_OrderedByPopularity()
socialmediaurls = sm.GetSocialMediaSiteLinks_WithShareLinks({
'url':'http://www.earthfluent.com/',
'title':'EarthFluent',
})
#print(socialmediaurls.keys())
for socialmediasite in socialmediasites:
print(socialmediasite + " : " + socialmediaurls[socialmediasite])
pass