forked from cveira/social-media-scripting-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSBitLyModule.ps1
More file actions
66 lines (55 loc) · 2.41 KB
/
Copy pathPSBitLyModule.ps1
File metadata and controls
66 lines (55 loc) · 2.41 KB
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
<#
-------------------------------------------------------------------------------
Name: Social Media Scripting Framework
Module: Bitly.com
Version: 0.2 BETA
Date: 2013/02/03
Author: Carlos Veira Lorenzo
e-mail: cveira [at] thinkinbig [dot] org
blog: thinkinbig.org
twitter: @cveira
facebook: www.facebook.com/cveira
Google+: gplus.to/cveira
LinkedIn: es.linkedin.com/in/cveira/
-------------------------------------------------------------------------------
Support:
http://thinkinbig.org/oms/
Forums & Communities:
facebook.com/ThinkInBig
gplus.to/ThinkInBig
http://bit.ly/SMSF-Forum
-------------------------------------------------------------------------------
Code Mirror Sites:
https://smsf.codeplex.com/
https://github.com/cveira/social-media-scripting-framework
https://code.google.com/p/social-media-scripting-framework/
http://sourceforge.net/projects/smsf/
-------------------------------------------------------------------------------
Social Media Scripting Framework.
Copyright (C) 2013 Carlos Veira Lorenzo.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-------------------------------------------------------------------------------
#>
function Get-BLClicksFromPage( [ref] $PageSourceCode ) {
# $source = Get-PageSourceCode https://bitly.com/Vk1V37+
# Get-BLClicksFromPage ([ref] $source)
[string] $ClicksContentPattern = '(?s)<li[^>]*clicks orange[^>]*>(?<ClickThroughStats>.*?)</li>.*?'
[string] $ClicksCountPattern = '(?s)<span[^>]*global_info[^>]*>(?<ClickCountStats>.*?)</span>.*?'
$ClickThroughCount = 0
if ( $PageSourceCode.Value -match $ClicksContentPattern ) {
if ( $Matches.ClickThroughStats -match $ClicksCountPattern ) {
$ClickThroughCount = [int] $Matches.ClickCountStats.Trim()
}
}
$ClickThroughCount
}