| 1 | Imports System.Web
|
|---|
| 2 |
|
|---|
| 3 | Public Class Twitter
|
|---|
| 4 | Public links As New Collections.Specialized.StringCollection
|
|---|
| 5 | Public follower As New Collections.Specialized.StringCollection
|
|---|
| 6 |
|
|---|
| 7 | Private _authKey As String 'StatusUpdate、発言削除で使用
|
|---|
| 8 | Private _authKeyDM As String 'DM送信、DM削除で使用
|
|---|
| 9 | 'Private _authSiv As String 'StatusUpdate等で使用
|
|---|
| 10 |
|
|---|
| 11 | Private _uid As String
|
|---|
| 12 | Private _pwd As String
|
|---|
| 13 | 'Private _lastId As String
|
|---|
| 14 | 'Private _lastName As String
|
|---|
| 15 | Private _nextThreshold As Integer
|
|---|
| 16 | Private _nextPages As Integer
|
|---|
| 17 | 'Private _iconSz As Integer
|
|---|
| 18 |
|
|---|
| 19 | Private _infoTwitter As String = ""
|
|---|
| 20 |
|
|---|
| 21 | Private _signed As Boolean
|
|---|
| 22 | Private _mySock As MySocket
|
|---|
| 23 |
|
|---|
| 24 | Private _hubServer As String
|
|---|
| 25 |
|
|---|
| 26 | Private _getIcon As Boolean
|
|---|
| 27 | Private _tinyUrlResolve As Boolean
|
|---|
| 28 | Private _dmCount As Integer
|
|---|
| 29 |
|
|---|
| 30 | Private Const _baseUrlStr As String = "twitter.com"
|
|---|
| 31 | Private Const _loginPath As String = "/sessions"
|
|---|
| 32 | Private Const _homePath As String = "/home"
|
|---|
| 33 | Private Const _replyPath As String = "/replies"
|
|---|
| 34 | Private Const _DMPathRcv As String = "/direct_messages"
|
|---|
| 35 | Private Const _DMPathSnt As String = "/direct_messages/sent"
|
|---|
| 36 | Private Const _DMDestroyPath As String = "/direct_messages/destroy/"
|
|---|
| 37 | Private Const _StDestroyPath As String = "/status/destroy/"
|
|---|
| 38 | 'Private Const _uidHeader As String = "username_or_email="
|
|---|
| 39 | Private Const _uidHeader As String = "session[username_or_email]="
|
|---|
| 40 | 'Private Const _pwdHeader As String = "password="
|
|---|
| 41 | Private Const _pwdHeader As String = "session[password]="
|
|---|
| 42 | Private Const _pageQry As String = "?page="
|
|---|
| 43 | Private Const _statusHeader As String = "status="
|
|---|
| 44 | Private Const _statusUpdatePath As String = "/status/update?page=1&tab=home"
|
|---|
| 45 | 'Private Const _statusUpdatePath1 As String = "/status/update?page=1&"
|
|---|
| 46 | 'Private Const _statusUpdatePath2 As String = "&tab=home"
|
|---|
| 47 | Private Const _statusUpdatePathAPI As String = "/statuses/update.xml"
|
|---|
| 48 | Private Const _linkToOld As String = "class=""section_links"" rel=""prev"""
|
|---|
| 49 | Private Const _postFavAddPath As String = "/favourings/create/"
|
|---|
| 50 | Private Const _postFavRemovePath As String = "/favourings/destroy/"
|
|---|
| 51 | Private Const _authKeyHeader As String = "authenticity_token="
|
|---|
| 52 | Private Const _parseLink1 As String = "<a href="""
|
|---|
| 53 | Private Const _parseLink2 As String = """>"
|
|---|
| 54 | Private Const _parseLink3 As String = "</a>"
|
|---|
| 55 |
|
|---|
| 56 | Private _splitPost As String = "<tr id=""status_"
|
|---|
| 57 | Private _splitPostRecent As String = "<tr id=""status_"
|
|---|
| 58 | Private _statusIdTo As String = """"
|
|---|
| 59 | 'Private _splitDM As String = "<li><a href=""/direct_messages/destroy/"
|
|---|
| 60 | Private _splitDM As String = "<tr class=""hentry"" id=""status_"
|
|---|
| 61 | Private _parseName As String = "://twitter.com/"
|
|---|
| 62 | Private _parseNameTo As String = """"
|
|---|
| 63 | Private _parseNick As String = "<img alt="""
|
|---|
| 64 | Private _parseNickTo As String = """"
|
|---|
| 65 | Private _parseImg As String = "src="""
|
|---|
| 66 | Private _parseImgTo As String = """"
|
|---|
| 67 | ' Private Const _parseMsg1 As String = "<span class=""entry-title entry-content"">"
|
|---|
| 68 | 'Private Const _parseMsg1_2 As String = "<span class=""entry_content"">"
|
|---|
| 69 | Private _parseMsg1 As String = "<span class=""entry-content"">"
|
|---|
| 70 | Private _parseMsg2 As String = "</span>"
|
|---|
| 71 | Private _parseDM1 As String = "<span class=""entry-content"">"
|
|---|
| 72 | Private _parseDM2 As String = "</span>"
|
|---|
| 73 | Private _parseDate As String = "<span class=""published"" title="""
|
|---|
| 74 | Private _parseDateTo As String = """"
|
|---|
| 75 | Private _getAuthKey As String = "<input type=""hidden"" id=""form_auth_token"" value="""
|
|---|
| 76 | Private _getAuthKeyTo As String = """"
|
|---|
| 77 | Private _parseStar As String = "<img alt="""
|
|---|
| 78 | Private _parseStarTo As String = """"
|
|---|
| 79 | Private _parseStarEmpty As String = "Favorite"
|
|---|
| 80 | Private _followerList As String = "<select id=""direct_message_user_id"" name=""user[id]""><option value="""" selected=""selected"">"
|
|---|
| 81 | Private _followerMbr1 As String = "/option>"
|
|---|
| 82 | Private _followerMbr2 As String = """>"
|
|---|
| 83 | Private _followerMbr3 As String = "<"
|
|---|
| 84 | 'Private _getSiv As String = "<input type=""hidden"" name=""siv"" value="""
|
|---|
| 85 | 'Private _getSivTo As String = """"
|
|---|
| 86 | Private _getInfoTwitter As String = "<div id=""top_alert"">"
|
|---|
| 87 | Private _getInfoTwitterTo As String = "</div>"
|
|---|
| 88 | Private _isProtect As String = "<img alt=""Icon_red_lock"""
|
|---|
| 89 | Private _isReplyEng As String = ">in reply to "
|
|---|
| 90 | Private _isReplyJpn As String = ">返信: "
|
|---|
| 91 | Private _isReplyTo As String = "<"
|
|---|
| 92 | Private _parseProtectMsg1 As String = "."" />"
|
|---|
| 93 | Private _parseProtectMsg2 As String = "<span class=""meta entry-meta"">"
|
|---|
| 94 | 'テスト実装:HomeのDM数が変わったときに取得
|
|---|
| 95 | Private _parseDMCount1 As String = "<a href=""/direct_messages"" id=""direct_messages_tab""><span id=""message_count"" class=""stat_count"">"
|
|---|
| 96 | Private _parseDMCount2 As String = "</span>"
|
|---|
| 97 |
|
|---|
| 98 | Private _endingFlag As Boolean
|
|---|
| 99 | Private _useAPI As Boolean
|
|---|
| 100 |
|
|---|
| 101 | '''Wedata対応
|
|---|
| 102 | Private Const wedataUrl As String = "http://wedata.net/databases/Tween/items.json"
|
|---|
| 103 | 'テーブル
|
|---|
| 104 | Private Const tbGetMsgDM As String = "GetMsgDM"
|
|---|
| 105 | Private Const tbSplitDM As String = "SplitDM"
|
|---|
| 106 | Private Const tbFollower As String = "Follower"
|
|---|
| 107 | Private Const tbGetStar As String = "GetStar"
|
|---|
| 108 | Private Const tbIsReply As String = "IsReply"
|
|---|
| 109 | Private Const tbGetDate As String = "GetDate"
|
|---|
| 110 | Private Const tbGetMsg As String = "GetMsg"
|
|---|
| 111 | Private Const tbIsProtect As String = "IsProtect"
|
|---|
| 112 | Private Const tbGetImagePath As String = "GetImagePath"
|
|---|
| 113 | Private Const tbGetNick As String = "GetNick"
|
|---|
| 114 | Private Const tbGetName As String = "GetName"
|
|---|
| 115 | 'Private Const tbGetSiv As String = "GetSiv"
|
|---|
| 116 | Private Const tbStatusID As String = "StatusID"
|
|---|
| 117 | Private Const tbSplitPostRecent As String = "SplitPostRecent"
|
|---|
| 118 | Private Const tbAuthKey As String = "AuthKey"
|
|---|
| 119 | Private Const tbInfoTwitter As String = "InfoTwitter"
|
|---|
| 120 | Private Const tbSplitPostReply As String = "SplitPostReply"
|
|---|
| 121 | '属性
|
|---|
| 122 | Private Const tbTagFrom As String = "tagfrom"
|
|---|
| 123 | Private Const tbTagTo As String = "tagto"
|
|---|
| 124 | Private Const tbTag As String = "tag"
|
|---|
| 125 | Private Const tbTagMbrFrom As String = "tagmbrfrom"
|
|---|
| 126 | Private Const tbTagMbrFrom2 As String = "tagmbrfrom2"
|
|---|
| 127 | Private Const tbTagMbrTo As String = "tagmbrto"
|
|---|
| 128 | Private Const tbTagStatus As String = "status"
|
|---|
| 129 | Private Const tbTagJpnFrom As String = "tagjpnfrom"
|
|---|
| 130 | Private Const tbTagEngFrom As String = "tagengfrom"
|
|---|
| 131 |
|
|---|
| 132 | Public savePost As String
|
|---|
| 133 |
|
|---|
| 134 | '画像の非同期取得
|
|---|
| 135 | '''Delegate Sub ThreadGetIcon(ByVal urlStr As String)
|
|---|
| 136 | '''Shared _threadGetIcon As ThreadGetIcon
|
|---|
| 137 |
|
|---|
| 138 | 'Public Structure MyLinks
|
|---|
| 139 | ' Public StartIndex As Integer
|
|---|
| 140 | ' Public Length As Integer
|
|---|
| 141 | ' Public UrlString As String
|
|---|
| 142 | 'End Structure
|
|---|
| 143 |
|
|---|
| 144 | Public Structure MyListItem
|
|---|
| 145 | Public Nick As String
|
|---|
| 146 | Public Data As String
|
|---|
| 147 | Public ImageUrl As String
|
|---|
| 148 | Public Name As String
|
|---|
| 149 | Public PDate As DateTime
|
|---|
| 150 | Public Id As String
|
|---|
| 151 | Public Fav As Boolean
|
|---|
| 152 | Public OrgData As String
|
|---|
| 153 | Public Readed As Boolean
|
|---|
| 154 | Public Reply As Boolean
|
|---|
| 155 | Public Protect As Boolean
|
|---|
| 156 | Public OWL As Boolean
|
|---|
| 157 | End Structure
|
|---|
| 158 |
|
|---|
| 159 | Public Enum GetTypes
|
|---|
| 160 | GET_TIMELINE
|
|---|
| 161 | GET_REPLY
|
|---|
| 162 | GET_DMRCV
|
|---|
| 163 | GET_DMSNT
|
|---|
| 164 | End Enum
|
|---|
| 165 |
|
|---|
| 166 | Public Sub New(Optional ByVal Username As String = "", Optional ByVal Password As String = "")
|
|---|
| 167 | 'Proxyを考慮したSocketの宛先設定
|
|---|
| 168 | 'TIconSmallList = New ImageList
|
|---|
| 169 | 'TIconSmallList.ImageSize = New Size(_iconSz, _iconSz)
|
|---|
| 170 | 'TIconSmallList.ColorDepth = ColorDepth.Depth32Bit
|
|---|
| 171 | _mySock = New MySocket("UTF-8", Username, Password)
|
|---|
| 172 | _uid = Username
|
|---|
| 173 | _pwd = Password
|
|---|
| 174 | follower.Add(_uid)
|
|---|
| 175 | End Sub
|
|---|
| 176 |
|
|---|
| 177 | Private Function SignIn() As String
|
|---|
| 178 | If _endingFlag Then Return ""
|
|---|
| 179 |
|
|---|
| 180 | 'ユーザー情報からデータ部分の生成
|
|---|
| 181 | Dim account As String = _uidHeader + _uid + "&" + _pwdHeader + _pwd
|
|---|
| 182 |
|
|---|
| 183 | '未認証
|
|---|
| 184 | _signed = False
|
|---|
| 185 |
|
|---|
| 186 | Dim resStatus As String = ""
|
|---|
| 187 | Dim resMsg As String = ""
|
|---|
| 188 |
|
|---|
| 189 | resMsg = _mySock.GetWebResponse("https://" + _hubServer + _loginPath, resStatus, MySocket.REQ_TYPE.ReqPOST, account)
|
|---|
| 190 | If resMsg.Length = 0 Then
|
|---|
| 191 | Return "SignIn -> " + resStatus
|
|---|
| 192 | End If
|
|---|
| 193 |
|
|---|
| 194 | '*************** ログイン失敗時の判定 ****************
|
|---|
| 195 | 'resMsgの中身を判定する
|
|---|
| 196 | '*****************************************************
|
|---|
| 197 |
|
|---|
| 198 | _signed = True
|
|---|
| 199 | Return ""
|
|---|
| 200 | End Function
|
|---|
| 201 |
|
|---|
| 202 | Public Function GetTimeline(ByVal tLine As List(Of MyListItem), ByVal page As Integer, ByVal initial As Boolean, ByRef endPage As Integer, ByVal gType As GetTypes, ByVal imgKeys As Collections.Specialized.StringCollection, ByVal imgs As ImageList, ByRef getDM As Boolean) As String
|
|---|
| 203 | If _endingFlag Then Return ""
|
|---|
| 204 |
|
|---|
| 205 | Dim retMsg As String = ""
|
|---|
| 206 | Dim resStatus As String = ""
|
|---|
| 207 | Dim moreRead As Boolean = True
|
|---|
| 208 | 'Dim oldID As String = ""
|
|---|
| 209 | 'Dim oldName As String = ""
|
|---|
| 210 |
|
|---|
| 211 | 'If initial Then
|
|---|
| 212 | ' oldID = _lastId
|
|---|
| 213 | ' oldName = _lastName
|
|---|
| 214 | 'End If
|
|---|
| 215 |
|
|---|
| 216 | If _signed = False Then
|
|---|
| 217 | retMsg = SignIn()
|
|---|
| 218 | If retMsg.Length > 0 Then
|
|---|
| 219 | Return retMsg
|
|---|
| 220 | End If
|
|---|
| 221 | End If
|
|---|
| 222 |
|
|---|
| 223 | 'リクエストメッセージを作成する
|
|---|
| 224 | Dim pageQuery As String
|
|---|
| 225 |
|
|---|
| 226 | If page = 1 Then
|
|---|
| 227 | pageQuery = ""
|
|---|
| 228 | Else
|
|---|
| 229 | pageQuery = _pageQry + page.ToString
|
|---|
| 230 | End If
|
|---|
| 231 | 'pageQuery = _pageQry + page.ToString
|
|---|
| 232 |
|
|---|
| 233 | If gType = GetTypes.GET_TIMELINE Then
|
|---|
| 234 | retMsg = _mySock.GetWebResponse("https://" + _hubServer + _homePath + pageQuery, resStatus)
|
|---|
| 235 | Else
|
|---|
| 236 | retMsg = _mySock.GetWebResponse("https://" + _hubServer + _replyPath + pageQuery, resStatus)
|
|---|
| 237 | End If
|
|---|
| 238 |
|
|---|
| 239 | If _endingFlag Then Return ""
|
|---|
| 240 |
|
|---|
| 241 | If retMsg.Length = 0 Then
|
|---|
| 242 | _signed = False
|
|---|
| 243 | Return resStatus
|
|---|
| 244 | End If
|
|---|
| 245 |
|
|---|
| 246 | '****************** Busy時の応答判定 ****************
|
|---|
| 247 | '****************************************************
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 | Dim pos1 As Integer
|
|---|
| 251 | Dim pos2 As Integer
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 | '各メッセージに分割可能か?
|
|---|
| 255 | Dim strSepTmp As String
|
|---|
| 256 | If gType = GetTypes.GET_TIMELINE Then
|
|---|
| 257 | strSepTmp = _splitPostRecent
|
|---|
| 258 | Else
|
|---|
| 259 | strSepTmp = _splitPost
|
|---|
| 260 | End If
|
|---|
| 261 | pos1 = retMsg.IndexOf(strSepTmp)
|
|---|
| 262 | If pos1 = -1 Then
|
|---|
| 263 | '0件 or 取得失敗
|
|---|
| 264 | _signed = False
|
|---|
| 265 | Return "GetTimeline -> Err: tweets count is 0."
|
|---|
| 266 | End If
|
|---|
| 267 |
|
|---|
| 268 | Dim strSep() As String = {strSepTmp}
|
|---|
| 269 | Dim posts() As String = retMsg.Split(strSep, StringSplitOptions.RemoveEmptyEntries)
|
|---|
| 270 | Dim strPost As String = ""
|
|---|
| 271 | Dim intCnt As Integer = 0
|
|---|
| 272 | Dim listCnt As Integer = tLine.Count
|
|---|
| 273 | Dim orgData As String = ""
|
|---|
| 274 | Dim tmpDate As DateTime = Now
|
|---|
| 275 | '''Dim imgKeys As Collections.Specialized.StringCollection = TIconList.Images.Keys
|
|---|
| 276 |
|
|---|
| 277 | '''_threadGetIcon = New ThreadGetIcon(AddressOf GetIconImage)
|
|---|
| 278 | '''Dim ar(posts.Length) As IAsyncResult
|
|---|
| 279 |
|
|---|
| 280 | For Each strPost In posts
|
|---|
| 281 | savePost = strPost
|
|---|
| 282 | intCnt += 1
|
|---|
| 283 | '''ar(intCnt) = Nothing
|
|---|
| 284 |
|
|---|
| 285 | If intCnt = 1 Then
|
|---|
| 286 | If page = 1 And gType = GetTypes.GET_TIMELINE Then
|
|---|
| 287 | ''siv取得
|
|---|
| 288 | 'pos1 = strPost.IndexOf(_getSiv, 0)
|
|---|
| 289 | 'If pos1 > 0 Then
|
|---|
| 290 | ' pos2 = strPost.IndexOf(_getSivTo, pos1 + _getSiv.Length)
|
|---|
| 291 | ' If pos2 > -1 Then
|
|---|
| 292 | ' _authSiv = strPost.Substring(pos1 + _getSiv.Length, pos2 - pos1 - _getSiv.Length)
|
|---|
| 293 | ' Else
|
|---|
| 294 | ' '取得失敗
|
|---|
| 295 | ' _signed = False
|
|---|
| 296 | ' Return "GetTimeline -> Err: Can't get Siv."
|
|---|
| 297 | ' End If
|
|---|
| 298 | 'Else
|
|---|
| 299 | ' '取得失敗
|
|---|
| 300 | ' _signed = False
|
|---|
| 301 | ' Return "GetTimeline -> Err: Can't get Siv."
|
|---|
| 302 | 'End If
|
|---|
| 303 |
|
|---|
| 304 | 'AuthKeyの取得
|
|---|
| 305 | If GetAuthKey(retMsg) < 0 Then
|
|---|
| 306 | _signed = False
|
|---|
| 307 | Return "GetTimeline -> Err: Can't get auth token."
|
|---|
| 308 | End If
|
|---|
| 309 |
|
|---|
| 310 | 'TwitterInfoの取得
|
|---|
| 311 | pos1 = retMsg.IndexOf(_getInfoTwitter)
|
|---|
| 312 | If pos1 > -1 Then
|
|---|
| 313 | pos2 = retMsg.IndexOf(_getInfoTwitterTo, pos1)
|
|---|
| 314 | If pos2 > -1 Then
|
|---|
| 315 | _infoTwitter = retMsg.Substring(pos1 + _getInfoTwitter.Length, pos2 - pos1 - _getInfoTwitter.Length)
|
|---|
| 316 | Else
|
|---|
| 317 | _infoTwitter = ""
|
|---|
| 318 | End If
|
|---|
| 319 | Else
|
|---|
| 320 | _infoTwitter = ""
|
|---|
| 321 | End If
|
|---|
| 322 | End If
|
|---|
| 323 | Else
|
|---|
| 324 |
|
|---|
| 325 | Dim lItem As New MyListItem
|
|---|
| 326 |
|
|---|
| 327 | Try
|
|---|
| 328 | 'Get ID
|
|---|
| 329 | pos1 = 0
|
|---|
| 330 | pos2 = strPost.IndexOf(_statusIdTo, 0)
|
|---|
| 331 | lItem.Id = HttpUtility.HtmlDecode(strPost.Substring(0, pos2))
|
|---|
| 332 | Catch ex As Exception
|
|---|
| 333 | _signed = False
|
|---|
| 334 | Return "GetTimeline -> Err: Can't get ID."
|
|---|
| 335 | End Try
|
|---|
| 336 | 'Get Name
|
|---|
| 337 | Try
|
|---|
| 338 | pos1 = strPost.IndexOf(_parseName, pos2)
|
|---|
| 339 | pos2 = strPost.IndexOf(_parseNameTo, pos1)
|
|---|
| 340 | lItem.Name = HttpUtility.HtmlDecode(strPost.Substring(pos1 + _parseName.Length, pos2 - pos1 - _parseName.Length))
|
|---|
| 341 | Catch ex As Exception
|
|---|
| 342 | _signed = False
|
|---|
| 343 | Return "GetTimeline -> Err: Can't get Name."
|
|---|
| 344 | End Try
|
|---|
| 345 | 'Get Nick
|
|---|
| 346 | '''バレンタイン対応
|
|---|
| 347 | If strPost.IndexOf("twitter.com/images/heart.png", pos2) > -1 Then
|
|---|
| 348 | lItem.Nick = lItem.Name
|
|---|
| 349 | Else
|
|---|
| 350 | Try
|
|---|
| 351 | pos1 = strPost.IndexOf(_parseNick, pos2)
|
|---|
| 352 | pos2 = strPost.IndexOf(_parseNickTo, pos1 + _parseNick.Length)
|
|---|
| 353 | lItem.Nick = HttpUtility.HtmlDecode(strPost.Substring(pos1 + _parseNick.Length, pos2 - pos1 - _parseNick.Length))
|
|---|
| 354 | Catch ex As Exception
|
|---|
| 355 | _signed = False
|
|---|
| 356 | Return "GetTimeline -> Err: Can't get Nick."
|
|---|
| 357 | End Try
|
|---|
| 358 | End If
|
|---|
| 359 |
|
|---|
| 360 | 'If initial Then
|
|---|
| 361 | ' '起動時
|
|---|
| 362 | ' If oldID = lItem.Id And oldName = lItem.Name Then
|
|---|
| 363 | ' '前回既読ポストなら読み込み終了
|
|---|
| 364 | ' moreRead = False
|
|---|
| 365 | ' End If
|
|---|
| 366 | 'End If
|
|---|
| 367 |
|
|---|
| 368 | '二重取得回避
|
|---|
| 369 | If links.Contains(lItem.Id) = False Then
|
|---|
| 370 | orgData = ""
|
|---|
| 371 | 'バレンタイン
|
|---|
| 372 | If strPost.IndexOf("<form action=""/status/update"" id=""heartForm", 0) > -1 Then
|
|---|
| 373 | Try
|
|---|
| 374 | pos1 = strPost.IndexOf("<strong>", 0)
|
|---|
| 375 | pos2 = strPost.IndexOf("</strong>", pos1)
|
|---|
| 376 | orgData = strPost.Substring(pos1 + 8, pos2 - pos1 - 8)
|
|---|
| 377 | Catch ex As Exception
|
|---|
| 378 | _signed = False
|
|---|
| 379 | Return "GetTimeline -> Err: Can't get Valentine body."
|
|---|
| 380 | End Try
|
|---|
| 381 | End If
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 | 'Get ImagePath
|
|---|
| 385 | Try
|
|---|
| 386 | pos1 = strPost.IndexOf(_parseImg, pos2)
|
|---|
| 387 | pos2 = strPost.IndexOf(_parseImgTo, pos1 + _parseImg.Length)
|
|---|
| 388 | lItem.ImageUrl = HttpUtility.HtmlDecode(strPost.Substring(pos1 + _parseImg.Length, pos2 - pos1 - _parseImg.Length))
|
|---|
| 389 | Catch ex As Exception
|
|---|
| 390 | _signed = False
|
|---|
| 391 | Return "GetTimeline -> Err: Can't get ImagePath."
|
|---|
| 392 | End Try
|
|---|
| 393 |
|
|---|
| 394 | 'Protect
|
|---|
| 395 | If strPost.IndexOf(_isProtect, pos2) > -1 Then
|
|---|
| 396 | lItem.Protect = True
|
|---|
| 397 | End If
|
|---|
| 398 |
|
|---|
| 399 | 'Get Message
|
|---|
| 400 | pos1 = strPost.IndexOf(_parseMsg1, pos2)
|
|---|
| 401 | 'If pos1 < 0 Then
|
|---|
| 402 | ' 'Twitterポカミス対応
|
|---|
| 403 | ' pos1 = strPost.IndexOf(_parseMsg1_2, pos2)
|
|---|
| 404 | 'End If
|
|---|
| 405 | If pos1 < 0 Then
|
|---|
| 406 | 'Valentine対応その2
|
|---|
| 407 | Try
|
|---|
| 408 | If strPost.IndexOf("<div id=""doyouheart", pos2) > -1 Then
|
|---|
| 409 | orgData += " <3 you! Do you <3 "
|
|---|
| 410 | pos1 = strPost.IndexOf("<a href", pos2)
|
|---|
| 411 | pos2 = strPost.IndexOf("?", pos1)
|
|---|
| 412 | orgData += strPost.Substring(pos1, pos2 - pos1 + 1)
|
|---|
| 413 | Else
|
|---|
| 414 | 'pos1 = strPost.IndexOf("."" />", pos2)
|
|---|
| 415 | pos1 = strPost.IndexOf(_parseProtectMsg1, pos2)
|
|---|
| 416 | If pos1 = -1 Then
|
|---|
| 417 | 'If orgData <> "You" Then
|
|---|
| 418 | ' orgData += lItem.Name + " <3 's "
|
|---|
| 419 | 'Else
|
|---|
| 420 | orgData += " <3 's "
|
|---|
| 421 | 'End If
|
|---|
| 422 | pos1 = strPost.IndexOf("<a href", pos2)
|
|---|
| 423 | If pos1 > -1 Then
|
|---|
| 424 | pos2 = strPost.IndexOf("!", pos1)
|
|---|
| 425 | orgData += strPost.Substring(pos1, pos2 - pos1 + 1)
|
|---|
| 426 | End If
|
|---|
| 427 | Else
|
|---|
| 428 | 'pos2 = strPost.IndexOf("<span class=""meta entry-meta"">", pos1)
|
|---|
| 429 | pos2 = strPost.IndexOf(_parseProtectMsg2, pos1)
|
|---|
| 430 | orgData = strPost.Substring(pos1 + _parseProtectMsg1.Length, pos2 - pos1 - _parseProtectMsg1.Length).Trim()
|
|---|
| 431 | End If
|
|---|
| 432 | End If
|
|---|
| 433 | Catch ex As Exception
|
|---|
| 434 | _signed = False
|
|---|
| 435 | Return "GetTimeline -> Err: Can't get Valentine body2."
|
|---|
| 436 | End Try
|
|---|
| 437 | Else
|
|---|
| 438 | Try
|
|---|
| 439 | pos2 = strPost.IndexOf(_parseMsg2, pos1)
|
|---|
| 440 | orgData = strPost.Substring(pos1 + _parseMsg1.Length, pos2 - pos1 - _parseMsg1.Length).Trim()
|
|---|
| 441 | Catch ex As Exception
|
|---|
| 442 | _signed = False
|
|---|
| 443 | Return "GetTimeline -> Err: Can't get body."
|
|---|
| 444 | End Try
|
|---|
| 445 | orgData = orgData.Replace("<3", "♡")
|
|---|
| 446 | End If
|
|---|
| 447 |
|
|---|
| 448 | Dim posl1 As Integer
|
|---|
| 449 | Dim posl2 As Integer = 0
|
|---|
| 450 | Dim posl3 As Integer
|
|---|
| 451 |
|
|---|
| 452 | If _tinyUrlResolve Then
|
|---|
| 453 | Do While True
|
|---|
| 454 | If orgData.IndexOf("<a href=""http://tinyurl.com/", posl2) > -1 Then
|
|---|
| 455 | Dim urlStr As String
|
|---|
| 456 | Try
|
|---|
| 457 | posl1 = orgData.IndexOf("<a href=""http://tinyurl.com/", posl2)
|
|---|
| 458 | posl1 = orgData.IndexOf("http://tinyurl.com/", posl1)
|
|---|
| 459 | posl2 = orgData.IndexOf("""", posl1)
|
|---|
| 460 | urlStr = orgData.Substring(posl1, posl2 - posl1)
|
|---|
| 461 | Catch ex As Exception
|
|---|
| 462 | _signed = False
|
|---|
| 463 | Return "GetTimeline -> Err: Can't get tinyurl."
|
|---|
| 464 | End Try
|
|---|
| 465 | Dim Response As String = ""
|
|---|
| 466 | Dim retUrlStr As String = ""
|
|---|
| 467 | retUrlStr = _mySock.GetWebResponse(urlStr, Response, MySocket.REQ_TYPE.ReqGETForwardTo)
|
|---|
| 468 | If retUrlStr.Length > 0 Then
|
|---|
| 469 | orgData = orgData.Replace("<a href=""" + urlStr, "<a href=""" + retUrlStr)
|
|---|
| 470 | End If
|
|---|
| 471 | Else
|
|---|
| 472 | Exit Do
|
|---|
| 473 | End If
|
|---|
| 474 | Loop
|
|---|
| 475 |
|
|---|
| 476 | End If
|
|---|
| 477 |
|
|---|
| 478 | lItem.OrgData = orgData
|
|---|
| 479 | lItem.OrgData = lItem.OrgData.Replace("<a href=""/", "<a href=""https://twitter.com/")
|
|---|
| 480 | lItem.OrgData = lItem.OrgData.Replace("<a href=", "<a target=""_self"" href=")
|
|---|
| 481 | lItem.OrgData = lItem.OrgData.Replace(vbLf, "<br>")
|
|---|
| 482 | 'lItem.OrgData = HttpUtility.HtmlDecode(lItem.OrgData)
|
|---|
| 483 | 'orgData = HttpUtility.HtmlDecode(orgData)
|
|---|
| 484 |
|
|---|
| 485 | 'Dim LinkCol As New List(Of MyLinks)
|
|---|
| 486 |
|
|---|
| 487 | Try
|
|---|
| 488 | If orgData.IndexOf(_parseLink1) = -1 Then
|
|---|
| 489 | lItem.Data = HttpUtility.HtmlDecode(orgData)
|
|---|
| 490 | Else
|
|---|
| 491 | lItem.Data = ""
|
|---|
| 492 | 'posl1 = orgData.IndexOf(_parseLink1)
|
|---|
| 493 |
|
|---|
| 494 | posl3 = 0
|
|---|
| 495 | Do While True
|
|---|
| 496 | 'Dim _myLink As New MyLinks
|
|---|
| 497 | 'Dim tmpLink As String
|
|---|
| 498 |
|
|---|
| 499 | posl1 = orgData.IndexOf(_parseLink1, posl3)
|
|---|
| 500 | If posl1 = -1 Then Exit Do
|
|---|
| 501 |
|
|---|
| 502 | If (posl3 + _parseLink3.Length <> posl1) Or posl3 = 0 Then
|
|---|
| 503 | If posl3 <> 0 Then
|
|---|
| 504 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl3 + _parseLink3.Length, posl1 - posl3 - _parseLink3.Length))
|
|---|
| 505 | Else
|
|---|
| 506 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(0, posl1))
|
|---|
| 507 | End If
|
|---|
| 508 | End If
|
|---|
| 509 | posl2 = orgData.IndexOf(_parseLink2, posl1)
|
|---|
| 510 | posl3 = orgData.IndexOf(_parseLink3, posl2)
|
|---|
| 511 | '_myLink.StartIndex = lItem.Data.Length
|
|---|
| 512 | 'tmpLink = HttpUtility.HtmlDecode(orgData.Substring(posl2 + _parseLink2.Length, posl3 - posl2 - _parseLink2.Length))
|
|---|
| 513 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl2 + _parseLink2.Length, posl3 - posl2 - _parseLink2.Length))
|
|---|
| 514 | '_myLink.Length = tmpLink.Length
|
|---|
| 515 | '_myLink.UrlString = orgData.Substring(posl1 + _parseLink1.Length, posl2 - posl1 - _parseLink1.Length)
|
|---|
| 516 | 'If _myLink.UrlString.IndexOf(_IsHTTP) = -1 Then
|
|---|
| 517 | ' _myLink.UrlString = "http://" + _hubServer + _myLink.UrlString
|
|---|
| 518 | 'End If
|
|---|
| 519 | 'If _myLink.UrlString.IndexOf("""") >= 0 Then
|
|---|
| 520 | ' _myLink.UrlString = _myLink.UrlString.Substring(0, _myLink.UrlString.IndexOf(""""))
|
|---|
| 521 | 'End If
|
|---|
| 522 | 'LinkCol.Add(_myLink)
|
|---|
| 523 | Loop
|
|---|
| 524 |
|
|---|
| 525 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl3 + _parseLink3.Length))
|
|---|
| 526 | End If
|
|---|
| 527 | Catch ex As Exception
|
|---|
| 528 | _signed = False
|
|---|
| 529 | Return "GetTimeline -> Err: Can't parse links."
|
|---|
| 530 | End Try
|
|---|
| 531 |
|
|---|
| 532 | 'Get Date
|
|---|
| 533 | pos1 = strPost.IndexOf(_parseDate, pos2)
|
|---|
| 534 | If pos1 > -1 Then
|
|---|
| 535 | Try
|
|---|
| 536 | pos2 = strPost.IndexOf(_parseDateTo, pos1 + _parseDate.Length)
|
|---|
| 537 | lItem.PDate = DateTime.ParseExact(strPost.Substring(pos1 + _parseDate.Length, pos2 - pos1 - _parseDate.Length), "yyyy'-'MM'-'dd'T'HH':'mm':'sszzz", System.Globalization.DateTimeFormatInfo.InvariantInfo, Globalization.DateTimeStyles.None)
|
|---|
| 538 | tmpDate = lItem.PDate
|
|---|
| 539 | Catch ex As Exception
|
|---|
| 540 | _signed = False
|
|---|
| 541 | Return "GetTimeline -> Err: Can't get date."
|
|---|
| 542 | End Try
|
|---|
| 543 | Else
|
|---|
| 544 | lItem.PDate = tmpDate
|
|---|
| 545 | End If
|
|---|
| 546 |
|
|---|
| 547 | 'Get Reply
|
|---|
| 548 | If strPost.IndexOf(_isReplyEng + _uid + _isReplyTo) > 0 Or strPost.IndexOf(_isReplyJpn + _uid + _isReplyTo) > 0 Then
|
|---|
| 549 | lItem.Reply = True
|
|---|
| 550 | Else
|
|---|
| 551 | lItem.Reply = False
|
|---|
| 552 | End If
|
|---|
| 553 |
|
|---|
| 554 | 'Get Fav
|
|---|
| 555 | pos1 = strPost.IndexOf(_parseStar, pos2)
|
|---|
| 556 | If pos1 > -1 Then
|
|---|
| 557 | Try
|
|---|
| 558 | pos2 = strPost.IndexOf(_parseStarTo, pos1 + _parseStar.Length)
|
|---|
| 559 | If strPost.Substring(pos1 + _parseStar.Length, pos2 - pos1 - _parseStar.Length) = _parseStarEmpty Then
|
|---|
| 560 | lItem.Fav = False
|
|---|
| 561 | Else
|
|---|
| 562 | lItem.Fav = True
|
|---|
| 563 | End If
|
|---|
| 564 | Catch ex As Exception
|
|---|
| 565 | _signed = False
|
|---|
| 566 | Return "GetTimeline -> Err: Can't get fav status."
|
|---|
| 567 | End Try
|
|---|
| 568 | Else
|
|---|
| 569 | lItem.Fav = False
|
|---|
| 570 | End If
|
|---|
| 571 |
|
|---|
| 572 | 'Imageの取得
|
|---|
| 573 | '''If imgKeys.Contains(lItem.ImageUrl) = False Then
|
|---|
| 574 | ''' imgKeys.Add(lItem.ImageUrl)
|
|---|
| 575 | ''' ar(intCnt) = _threadGetIcon.BeginInvoke(lItem.ImageUrl, Nothing, Nothing)
|
|---|
| 576 | ''' 'retMsg = GetIconImage(lItem.ImageUrl, TIconList, TIconSmallList)
|
|---|
| 577 | ''' 'If retMsg.Length > 0 Then
|
|---|
| 578 | ''' ' Return retMsg
|
|---|
| 579 | ''' 'End If
|
|---|
| 580 | '''End If
|
|---|
| 581 | If imgKeys.Contains(lItem.ImageUrl) = False Then
|
|---|
| 582 | GetIconImage(lItem.ImageUrl, imgKeys, imgs)
|
|---|
| 583 | End If
|
|---|
| 584 |
|
|---|
| 585 | If _endingFlag Then Return ""
|
|---|
| 586 |
|
|---|
| 587 | 'links.Add(lItem.Name + "_" + lItem.Id, LinkCol)
|
|---|
| 588 | links.Add(lItem.Id)
|
|---|
| 589 | tLine.Add(lItem)
|
|---|
| 590 | End If
|
|---|
| 591 |
|
|---|
| 592 | 'テスト実装:DMカウント取得
|
|---|
| 593 | getDM = False
|
|---|
| 594 | If intCnt = posts.Length And gType = GetTypes.GET_TIMELINE And page = 1 Then
|
|---|
| 595 | pos1 = strPost.IndexOf(_parseDMCount1, pos2)
|
|---|
| 596 | If pos1 > -1 Then
|
|---|
| 597 | Try
|
|---|
| 598 | pos2 = strPost.IndexOf(_parseDMCount2, pos1 + _parseDMCount1.Length)
|
|---|
| 599 | Dim dmCnt As Integer = Integer.Parse(strPost.Substring(pos1 + _parseDMCount1.Length, pos2 - pos1 - _parseDMCount1.Length))
|
|---|
| 600 | If dmCnt > _dmCount Then
|
|---|
| 601 | _dmCount = dmCnt
|
|---|
| 602 | getDM = True
|
|---|
| 603 | End If
|
|---|
| 604 | Catch ex As Exception
|
|---|
| 605 | End Try
|
|---|
| 606 | End If
|
|---|
| 607 | End If
|
|---|
| 608 | End If
|
|---|
| 609 | Next
|
|---|
| 610 |
|
|---|
| 611 | '非同期のアイコン読み込み終了待ち
|
|---|
| 612 | '''For intCnt = 1 To ar.Length - 1
|
|---|
| 613 | ''' If Not ar(intCnt) Is Nothing Then
|
|---|
| 614 | ''' Do While ar(intCnt).IsCompleted = False
|
|---|
| 615 | ''' System.Threading.Thread.Sleep(500)
|
|---|
| 616 | ''' Loop
|
|---|
| 617 | ''' End If
|
|---|
| 618 | '''Next
|
|---|
| 619 |
|
|---|
| 620 | Dim getCnt As Integer
|
|---|
| 621 | getCnt = tLine.Count - listCnt
|
|---|
| 622 | If getCnt > 0 Then
|
|---|
| 623 | '新規取得有
|
|---|
| 624 | If initial Then
|
|---|
| 625 | '起動時
|
|---|
| 626 | 'If strPost.IndexOf(_linkToOld) > -1 Then
|
|---|
| 627 | '最大でも最終ページまで、前回既読位置記録有→前回既読位置まで
|
|---|
| 628 | If moreRead Then
|
|---|
| 629 | '前回既読ポストなし→次頁読み込み
|
|---|
| 630 | endPage = page + 1
|
|---|
| 631 | 'retMsg = GetTimeline(tLine, page + 1, True, endPage)
|
|---|
| 632 | 'If retMsg.Length > 0 Then
|
|---|
| 633 | ' 'エラーがあったら終了
|
|---|
| 634 | ' Return retMsg
|
|---|
| 635 | 'End If
|
|---|
| 636 | End If
|
|---|
| 637 | 'End If
|
|---|
| 638 | End If
|
|---|
| 639 | End If
|
|---|
| 640 | '通常時
|
|---|
| 641 | If ((page = 1 And getCnt >= _nextThreshold) Or page > 1) And initial = False Then
|
|---|
| 642 | '新着が閾値の件数以上なら、次のページも念のため読み込み
|
|---|
| 643 | endPage = _nextPages + 1
|
|---|
| 644 | 'If page + 1 <= _nextPages Then
|
|---|
| 645 | ' endPage = page + _nextPages
|
|---|
| 646 | 'End If
|
|---|
| 647 |
|
|---|
| 648 | 'For cnt As Integer = 1 To _nextPages
|
|---|
| 649 | ' If endPage < page + cnt Then
|
|---|
| 650 | ' retMsg = GetTimeline(tLine, page + cnt, False, endPage)
|
|---|
| 651 | ' If retMsg.Length > 0 Then
|
|---|
| 652 | ' Return retMsg
|
|---|
| 653 | ' End If
|
|---|
| 654 | ' End If
|
|---|
| 655 | 'Next
|
|---|
| 656 | End If
|
|---|
| 657 |
|
|---|
| 658 | Return ""
|
|---|
| 659 | End Function
|
|---|
| 660 |
|
|---|
| 661 | Public Function GetDirectMessage(ByVal tLine As List(Of MyListItem), ByVal page As Integer, ByRef endPage As Integer, ByVal gType As GetTypes, ByVal imgKeys As Collections.Specialized.StringCollection, ByVal imgs As ImageList) As String
|
|---|
| 662 | If _endingFlag Then Return ""
|
|---|
| 663 |
|
|---|
| 664 | Dim retMsg As String = ""
|
|---|
| 665 | Dim resStatus As String = ""
|
|---|
| 666 | Dim moreRead As Boolean = True
|
|---|
| 667 | Dim oldID As String = ""
|
|---|
| 668 | Dim oldName As String = ""
|
|---|
| 669 |
|
|---|
| 670 | endPage = page
|
|---|
| 671 |
|
|---|
| 672 | If _signed = False Then
|
|---|
| 673 | retMsg = SignIn()
|
|---|
| 674 | If retMsg.Length > 0 Then
|
|---|
| 675 | Return retMsg
|
|---|
| 676 | End If
|
|---|
| 677 | End If
|
|---|
| 678 |
|
|---|
| 679 | If _endingFlag Then Return ""
|
|---|
| 680 |
|
|---|
| 681 | 'リクエストメッセージを作成する
|
|---|
| 682 | Dim pageQuery As String
|
|---|
| 683 |
|
|---|
| 684 | 'If page = 1 Then
|
|---|
| 685 | ' pageQuery = ""
|
|---|
| 686 | 'Else
|
|---|
| 687 | ' pageQuery = _pageQry + page.ToString
|
|---|
| 688 | 'End If
|
|---|
| 689 | pageQuery = _pageQry + page.ToString
|
|---|
| 690 |
|
|---|
| 691 | If gType = GetTypes.GET_DMRCV Then
|
|---|
| 692 | retMsg = _mySock.GetWebResponse("https://" + _hubServer + _DMPathRcv + pageQuery, resStatus)
|
|---|
| 693 | Else
|
|---|
| 694 | retMsg = _mySock.GetWebResponse("https://" + _hubServer + _DMPathSnt + pageQuery, resStatus)
|
|---|
| 695 | End If
|
|---|
| 696 | If retMsg.Length = 0 Then
|
|---|
| 697 | _signed = False
|
|---|
| 698 | Return resStatus
|
|---|
| 699 | End If
|
|---|
| 700 |
|
|---|
| 701 | If _endingFlag Then Return ""
|
|---|
| 702 |
|
|---|
| 703 | '****************** Busy時の応答判定 ****************
|
|---|
| 704 | '****************************************************
|
|---|
| 705 |
|
|---|
| 706 | ''AuthKeyの取得
|
|---|
| 707 | 'If GetAuthKeyDM(retMsg) < 0 Then
|
|---|
| 708 | ' _signed = False
|
|---|
| 709 | ' Return "GetDirectMessage -> Err: Busy(1)"
|
|---|
| 710 | 'End If
|
|---|
| 711 |
|
|---|
| 712 | Dim pos1 As Integer
|
|---|
| 713 | Dim pos2 As Integer
|
|---|
| 714 |
|
|---|
| 715 | 'Followerの抽出
|
|---|
| 716 | If page = 1 And gType = GetTypes.GET_DMRCV Then
|
|---|
| 717 | pos1 = retMsg.IndexOf(_followerList)
|
|---|
| 718 | If pos1 = -1 Then
|
|---|
| 719 | '取得失敗
|
|---|
| 720 | _signed = False
|
|---|
| 721 | Return "GetDirectMessage -> Err: Busy(3)"
|
|---|
| 722 | End If
|
|---|
| 723 | follower.Clear()
|
|---|
| 724 | follower.Add(_uid)
|
|---|
| 725 | pos1 += _followerList.Length
|
|---|
| 726 | pos1 = retMsg.IndexOf(_followerMbr1, pos1)
|
|---|
| 727 | Try
|
|---|
| 728 | Do While pos1 > -1
|
|---|
| 729 | pos2 = retMsg.IndexOf(_followerMbr2, pos1)
|
|---|
| 730 | pos1 = retMsg.IndexOf(_followerMbr3, pos2)
|
|---|
| 731 | follower.Add(retMsg.Substring(pos2 + _followerMbr2.Length, pos1 - pos2 - _followerMbr2.Length))
|
|---|
| 732 | pos1 = retMsg.IndexOf(_followerMbr1, pos1)
|
|---|
| 733 | Loop
|
|---|
| 734 | Catch ex As Exception
|
|---|
| 735 | _signed = False
|
|---|
| 736 | Return "GetDirectMessage -> Err: Can't get followers"
|
|---|
| 737 | End Try
|
|---|
| 738 | End If
|
|---|
| 739 |
|
|---|
| 740 | '各メッセージに分割可能か?
|
|---|
| 741 | pos1 = retMsg.IndexOf(_splitDM)
|
|---|
| 742 | If pos1 = -1 Then
|
|---|
| 743 | '0件
|
|---|
| 744 | Return ""
|
|---|
| 745 | End If
|
|---|
| 746 |
|
|---|
| 747 | Dim strSep() As String = {_splitDM}
|
|---|
| 748 | Dim posts() As String = retMsg.Split(strSep, StringSplitOptions.RemoveEmptyEntries)
|
|---|
| 749 | Dim strPost As String = ""
|
|---|
| 750 | Dim intCnt As Integer = 0
|
|---|
| 751 | Dim listCnt As Integer = tLine.Count
|
|---|
| 752 | Dim orgData As String = ""
|
|---|
| 753 | '''Dim imgKeys As Collections.Specialized.StringCollection = TIconList.Images.Keys
|
|---|
| 754 |
|
|---|
| 755 | '''_threadGetIcon = New ThreadGetIcon(AddressOf GetIconImage)
|
|---|
| 756 | '''Dim ar(posts.Length) As IAsyncResult
|
|---|
| 757 |
|
|---|
| 758 | For Each strPost In posts
|
|---|
| 759 | savePost = strPost
|
|---|
| 760 | intCnt += 1
|
|---|
| 761 | '''ar(intCnt) = Nothing
|
|---|
| 762 |
|
|---|
| 763 | If intCnt > 1 Then
|
|---|
| 764 | Dim lItem As New MyListItem
|
|---|
| 765 | Dim flg As Boolean = False
|
|---|
| 766 |
|
|---|
| 767 | 'Get ID
|
|---|
| 768 | Try
|
|---|
| 769 | pos1 = 0
|
|---|
| 770 | pos2 = strPost.IndexOf("""", 0)
|
|---|
| 771 | lItem.Id = HttpUtility.HtmlDecode(strPost.Substring(0, pos2))
|
|---|
| 772 | Catch ex As Exception
|
|---|
| 773 | _signed = False
|
|---|
| 774 | Return "GetDirectMessage -> Err: Can't get ID"
|
|---|
| 775 | End Try
|
|---|
| 776 |
|
|---|
| 777 | 'Get Name
|
|---|
| 778 | Try
|
|---|
| 779 | pos1 = strPost.IndexOf(_parseName, pos2)
|
|---|
| 780 | pos2 = strPost.IndexOf(_parseNameTo, pos1)
|
|---|
| 781 | lItem.Name = HttpUtility.HtmlDecode(strPost.Substring(pos1 + _parseName.Length, pos2 - pos1 - _parseName.Length))
|
|---|
| 782 | Catch ex As Exception
|
|---|
| 783 | _signed = False
|
|---|
| 784 | Return "GetDirectMessage -> Err: Can't get Name"
|
|---|
| 785 | End Try
|
|---|
| 786 |
|
|---|
| 787 | 'Get Nick
|
|---|
| 788 | 'pos1 = strPost.IndexOf(_parseNick, pos2)
|
|---|
| 789 | 'pos2 = strPost.IndexOf("""", pos1 + _parseNick.Length)
|
|---|
| 790 | 'lItem.Nick = HttpUtility.HtmlDecode(strPost.Substring(pos1 + _parseNick.Length, pos2 - pos1 - _parseNick.Length))
|
|---|
| 791 | lItem.Nick = lItem.Name
|
|---|
| 792 |
|
|---|
| 793 | If links.Contains(lItem.Id) Then
|
|---|
| 794 | flg = True
|
|---|
| 795 | End If
|
|---|
| 796 |
|
|---|
| 797 | If flg = False Then
|
|---|
| 798 | 'Get ImagePath
|
|---|
| 799 | Try
|
|---|
| 800 | pos1 = strPost.IndexOf(_parseImg, pos2)
|
|---|
| 801 | pos2 = strPost.IndexOf(_parseImgTo, pos1 + _parseImg.Length)
|
|---|
| 802 | lItem.ImageUrl = HttpUtility.HtmlDecode(strPost.Substring(pos1 + _parseImg.Length, pos2 - pos1 - _parseImg.Length))
|
|---|
| 803 | Catch ex As Exception
|
|---|
| 804 | _signed = False
|
|---|
| 805 | Return "GetDirectMessage -> Err: Can't get ImagePath"
|
|---|
| 806 | End Try
|
|---|
| 807 |
|
|---|
| 808 | 'Get Message
|
|---|
| 809 | Try
|
|---|
| 810 | pos1 = strPost.IndexOf(_parseDM1, pos2)
|
|---|
| 811 | pos2 = strPost.IndexOf(_parseDM2, pos1)
|
|---|
| 812 | orgData = strPost.Substring(pos1 + _parseDM1.Length, pos2 - pos1 - _parseDM1.Length).Trim()
|
|---|
| 813 | orgData = orgData.Replace("<3", "♡")
|
|---|
| 814 | Catch ex As Exception
|
|---|
| 815 | _signed = False
|
|---|
| 816 | Return "GetDirectMessage -> Err: Can't get body"
|
|---|
| 817 | End Try
|
|---|
| 818 |
|
|---|
| 819 | 'lItem.OrgData = "<font size=""2"">" + orgData + "</ font>"
|
|---|
| 820 | Dim posl1 As Integer
|
|---|
| 821 | Dim posl2 As Integer = 0
|
|---|
| 822 | Dim posl3 As Integer
|
|---|
| 823 |
|
|---|
| 824 | If _tinyUrlResolve Then
|
|---|
| 825 | Try
|
|---|
| 826 | Do While True
|
|---|
| 827 | If orgData.IndexOf("<a href=""http://tinyurl.com/", posl2) > -1 Then
|
|---|
| 828 | Dim urlStr As String
|
|---|
| 829 | posl1 = orgData.IndexOf("<a href=""http://tinyurl.com/", posl2)
|
|---|
| 830 | posl1 = orgData.IndexOf("http://tinyurl.com/", posl1)
|
|---|
| 831 | posl2 = orgData.IndexOf("""", posl1)
|
|---|
| 832 | urlStr = orgData.Substring(posl1, posl2 - posl1)
|
|---|
| 833 | Dim Response As String = ""
|
|---|
| 834 | Dim retUrlStr As String = ""
|
|---|
| 835 | retUrlStr = _mySock.GetWebResponse(urlStr, Response, MySocket.REQ_TYPE.ReqGETForwardTo)
|
|---|
| 836 | If retUrlStr.Length > 0 Then
|
|---|
| 837 | orgData = orgData.Replace("<a href=""" + urlStr, "<a href=""" + retUrlStr)
|
|---|
| 838 | End If
|
|---|
| 839 | Else
|
|---|
| 840 | Exit Do
|
|---|
| 841 | End If
|
|---|
| 842 | Loop
|
|---|
| 843 | Catch ex As Exception
|
|---|
| 844 | _signed = False
|
|---|
| 845 | Return "GetDirectMessage -> Err: Can't parse tinyurl"
|
|---|
| 846 | End Try
|
|---|
| 847 | End If
|
|---|
| 848 |
|
|---|
| 849 | lItem.OrgData = orgData
|
|---|
| 850 | lItem.OrgData = lItem.OrgData.Replace("<a href=""/", "<a href=""https://twitter.com/")
|
|---|
| 851 | lItem.OrgData = lItem.OrgData.Replace("<a href=", "<a target=""_self"" href=")
|
|---|
| 852 | lItem.OrgData = lItem.OrgData.Replace(vbLf, "<br>")
|
|---|
| 853 | 'lItem.OrgData = HttpUtility.HtmlDecode(lItem.OrgData)
|
|---|
| 854 |
|
|---|
| 855 | 'Dim LinkCol As New List(Of MyLinks)
|
|---|
| 856 |
|
|---|
| 857 | Try
|
|---|
| 858 | If orgData.IndexOf(_parseLink1) = -1 Then
|
|---|
| 859 | lItem.Data = HttpUtility.HtmlDecode(orgData)
|
|---|
| 860 | Else
|
|---|
| 861 | lItem.Data = ""
|
|---|
| 862 | 'posl1 = orgData.IndexOf(_parseLink1)
|
|---|
| 863 |
|
|---|
| 864 | posl3 = 0
|
|---|
| 865 | Do While True
|
|---|
| 866 | 'Dim _myLink As New MyLinks
|
|---|
| 867 | 'Dim tmpLink As String
|
|---|
| 868 |
|
|---|
| 869 | posl1 = orgData.IndexOf(_parseLink1, posl3)
|
|---|
| 870 | If posl1 = -1 Then Exit Do
|
|---|
| 871 |
|
|---|
| 872 | If (posl3 + _parseLink3.Length <> posl1) Or posl3 = 0 Then
|
|---|
| 873 | If posl3 <> 0 Then
|
|---|
| 874 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl3 + _parseLink3.Length, posl1 - posl3 - _parseLink3.Length))
|
|---|
| 875 | Else
|
|---|
| 876 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(0, posl1))
|
|---|
| 877 | End If
|
|---|
| 878 | End If
|
|---|
| 879 | posl2 = orgData.IndexOf(_parseLink2, posl1)
|
|---|
| 880 | posl3 = orgData.IndexOf(_parseLink3, posl2)
|
|---|
| 881 | '_myLink.StartIndex = lItem.Data.Length
|
|---|
| 882 | 'tmpLink = HttpUtility.HtmlDecode(orgData.Substring(posl2 + _parseLink2.Length, posl3 - posl2 - _parseLink2.Length))
|
|---|
| 883 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl2 + _parseLink2.Length, posl3 - posl2 - _parseLink2.Length))
|
|---|
| 884 | '_myLink.Length = tmpLink.Length
|
|---|
| 885 | '_myLink.UrlString = orgData.Substring(posl1 + _parseLink1.Length, posl2 - posl1 - _parseLink1.Length)
|
|---|
| 886 | 'If _myLink.UrlString.IndexOf(_IsHTTP) = -1 Then
|
|---|
| 887 | ' _myLink.UrlString = "http://" + _hubServer + _myLink.UrlString
|
|---|
| 888 | 'End If
|
|---|
| 889 | 'If _myLink.UrlString.IndexOf("""") >= 0 Then
|
|---|
| 890 | ' _myLink.UrlString = _myLink.UrlString.Substring(0, _myLink.UrlString.IndexOf(""""))
|
|---|
| 891 | 'End If
|
|---|
| 892 | 'LinkCol.Add(_myLink)
|
|---|
| 893 | Loop
|
|---|
| 894 |
|
|---|
| 895 |
|
|---|
| 896 | lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl3 + _parseLink3.Length))
|
|---|
| 897 | End If
|
|---|
| 898 | Catch ex As Exception
|
|---|
| 899 | _signed = False
|
|---|
| 900 | Return "GetDirectMessage -> Err: Can't parse links"
|
|---|
| 901 | End Try
|
|---|
| 902 |
|
|---|
| 903 | 'Get Date
|
|---|
| 904 | 'pos1 = strPost.IndexOf(_parseDate, pos2)
|
|---|
| 905 | 'pos2 = strPost.IndexOf("""", pos1 + _parseDate.Length)
|
|---|
| 906 | 'lItem.PDate = DateTime.ParseExact(strPost.Substring(pos1 + _parseDate.Length, pos2 - pos1 - _parseDate.Length), "yyyy'-'MM'-'dd'T'HH':'mm':'sszzz", System.Globalization.DateTimeFormatInfo.InvariantInfo, Globalization.DateTimeStyles.None)
|
|---|
| 907 | lItem.PDate = Now()
|
|---|
| 908 |
|
|---|
| 909 | 'Get Fav
|
|---|
| 910 | 'pos1 = strPost.IndexOf(_parseStar, pos2)
|
|---|
| 911 | 'pos2 = strPost.IndexOf("""", pos1 + _parseStar.Length)
|
|---|
| 912 | 'If strPost.Substring(pos1 + _parseStar.Length, pos2 - pos1 - _parseStar.Length) = "empty" Then
|
|---|
| 913 | ' lItem.Fav = False
|
|---|
| 914 | 'Else
|
|---|
| 915 | ' lItem.Fav = True
|
|---|
| 916 | 'End If
|
|---|
| 917 | lItem.Fav = False
|
|---|
| 918 |
|
|---|
| 919 | 'Imageの取得
|
|---|
| 920 | '''If imgKeys.Contains(lItem.ImageUrl) = False Then
|
|---|
| 921 | ''' imgKeys.Add(lItem.ImageUrl)
|
|---|
| 922 | ''' ar(intCnt) = _threadGetIcon.BeginInvoke(lItem.ImageUrl, Nothing, Nothing)
|
|---|
| 923 | ''' 'retMsg = GetIconImage(lItem.ImageUrl, TIconList, TIconSmallList)
|
|---|
| 924 | ''' 'If retMsg.Length > 0 Then
|
|---|
| 925 | ''' ' Return retMsg
|
|---|
| 926 | ''' 'End If
|
|---|
| 927 | '''End If
|
|---|
| 928 | If imgKeys.Contains(lItem.ImageUrl) = False Then
|
|---|
| 929 | GetIconImage(lItem.ImageUrl, imgKeys, imgs)
|
|---|
| 930 | End If
|
|---|
| 931 |
|
|---|
| 932 | If _endingFlag Then Return ""
|
|---|
| 933 |
|
|---|
| 934 | 'links.Add(lItem.Name + "_" + lItem.Id, LinkCol)
|
|---|
| 935 | links.Add(lItem.Id)
|
|---|
| 936 | tLine.Add(lItem)
|
|---|
| 937 | End If
|
|---|
| 938 | End If
|
|---|
| 939 | Next
|
|---|
| 940 |
|
|---|
| 941 | '''For intCnt = 1 To ar.Length - 1
|
|---|
| 942 | ''' If Not ar(intCnt) Is Nothing Then
|
|---|
| 943 | ''' Do While ar(intCnt).IsCompleted = False
|
|---|
| 944 | ''' System.Threading.Thread.Sleep(500)
|
|---|
| 945 | ''' Loop
|
|---|
| 946 | ''' End If
|
|---|
| 947 | '''Next
|
|---|
| 948 |
|
|---|
| 949 | Dim getCnt As Integer
|
|---|
| 950 |
|
|---|
| 951 | getCnt = tLine.Count - listCnt
|
|---|
| 952 | If getCnt = 20 Then
|
|---|
| 953 | ' If strPost.IndexOf(_linkToOld) > -1 Then
|
|---|
| 954 | '*** 別スレッドで動かす
|
|---|
| 955 | 'retMsg = GetDirectMessage(tLine, page + 1, endPage)
|
|---|
| 956 | 'If retMsg.Length > 0 Then
|
|---|
| 957 | ' Return retMsg
|
|---|
| 958 | 'End If
|
|---|
| 959 | ' End If
|
|---|
| 960 | endPage += 1
|
|---|
| 961 | End If
|
|---|
| 962 |
|
|---|
| 963 | Return ""
|
|---|
| 964 | End Function
|
|---|
| 965 |
|
|---|
| 966 | Public Function SetOldTimeline(ByVal tLine As List(Of MyListItem), ByVal tLine2 As List(Of MyListItem)) As String
|
|---|
| 967 | ''' Dim orgData As String = ""
|
|---|
| 968 | ''' ' Dim retMsg As String
|
|---|
| 969 | ''' Dim imgKeys As Collections.Specialized.StringCollection = TIconList.Images.Keys
|
|---|
| 970 |
|
|---|
| 971 | ''' _threadGetIcon = New ThreadGetIcon(AddressOf GetIconImage)
|
|---|
| 972 | ''' Dim ar(tLine.Count - 1) As IAsyncResult
|
|---|
| 973 | ''' Dim cnt As Integer = 0
|
|---|
| 974 |
|
|---|
| 975 | ''' For cnt = 0 To tLine.Count - 1
|
|---|
| 976 | ''' Dim lItem As New MyListItem
|
|---|
| 977 | ''' ar(cnt) = Nothing
|
|---|
| 978 | ''' lItem.Data = tLine(cnt).Data
|
|---|
| 979 | ''' lItem.Fav = tLine(cnt).Fav
|
|---|
| 980 | ''' lItem.Id = tLine(cnt).Id
|
|---|
| 981 | ''' lItem.ImageUrl = tLine(cnt).ImageUrl
|
|---|
| 982 | ''' lItem.Name = tLine(cnt).Name
|
|---|
| 983 | ''' lItem.Nick = tLine(cnt).Nick
|
|---|
| 984 | ''' lItem.OrgData = tLine(cnt).OrgData
|
|---|
| 985 | ''' lItem.PDate = tLine(cnt).PDate
|
|---|
| 986 | ''' lItem.Unread = tLine(cnt).Unread
|
|---|
| 987 |
|
|---|
| 988 | ''' 'Get Message
|
|---|
| 989 | ''' orgData = lItem.OrgData.Replace("<a target=""_self""", "<a")
|
|---|
| 990 |
|
|---|
| 991 | ''' Dim posl1 As Integer
|
|---|
| 992 | ''' Dim posl2 As Integer
|
|---|
| 993 | ''' Dim posl3 As Integer
|
|---|
| 994 | ''' 'Dim LinkCol As New List(Of MyLinks)
|
|---|
| 995 |
|
|---|
| 996 | ''' If orgData.IndexOf(_parseLink1) = -1 Then
|
|---|
| 997 | ''' lItem.Data = orgData
|
|---|
| 998 | ''' Else
|
|---|
| 999 | ''' lItem.Data = ""
|
|---|
| 1000 | ''' posl1 = orgData.IndexOf(_parseLink1)
|
|---|
| 1001 |
|
|---|
| 1002 | ''' posl3 = 0
|
|---|
| 1003 | ''' Do While True
|
|---|
| 1004 | ''' 'Dim _myLink As New MyLinks
|
|---|
| 1005 | ''' 'Dim tmpLink As String
|
|---|
| 1006 |
|
|---|
| 1007 | ''' posl1 = orgData.IndexOf(_parseLink1, posl3)
|
|---|
| 1008 | ''' If posl1 = -1 Then Exit Do
|
|---|
| 1009 |
|
|---|
| 1010 | ''' If posl3 + _parseLink3.Length <> posl1 Or posl3 = 0 Then
|
|---|
| 1011 | ''' If posl3 <> 0 Then
|
|---|
| 1012 | ''' lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl3 + _parseLink3.Length, posl1 - posl3 - _parseLink3.Length))
|
|---|
| 1013 | ''' Else
|
|---|
| 1014 | ''' lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(0, posl1))
|
|---|
| 1015 | ''' End If
|
|---|
| 1016 | ''' End If
|
|---|
| 1017 | ''' posl2 = orgData.IndexOf(_parseLink2, posl1)
|
|---|
| 1018 | ''' posl3 = orgData.IndexOf(_parseLink3, posl2)
|
|---|
| 1019 | ''' '_myLink.StartIndex = lItem.Data.Length
|
|---|
| 1020 | ''' 'tmpLink = HttpUtility.HtmlDecode(orgData.Substring(posl2 + _parseLink2.Length, posl3 - posl2 - _parseLink2.Length))
|
|---|
| 1021 | ''' lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl2 + _parseLink2.Length, posl3 - posl2 - _parseLink2.Length))
|
|---|
| 1022 | ''' '_myLink.Length = tmpLink.Length
|
|---|
| 1023 | ''' '_myLink.UrlString = orgData.Substring(posl1 + _parseLink1.Length, posl2 - posl1 - _parseLink1.Length)
|
|---|
| 1024 | ''' 'If _myLink.UrlString.IndexOf(_IsHTTP) = -1 Then
|
|---|
| 1025 | ''' ' _myLink.UrlString = "http://" + _hubServer + _myLink.UrlString
|
|---|
| 1026 | ''' 'End If
|
|---|
| 1027 | ''' 'If _myLink.UrlString.IndexOf("""") >= 0 Then
|
|---|
| 1028 | ''' ' _myLink.UrlString = _myLink.UrlString.Substring(0, _myLink.UrlString.IndexOf(""""))
|
|---|
| 1029 | ''' 'End If
|
|---|
| 1030 | ''' 'LinkCol.Add(_myLink)
|
|---|
| 1031 | ''' Loop
|
|---|
| 1032 |
|
|---|
| 1033 | ''' lItem.Data += HttpUtility.HtmlDecode(orgData.Substring(posl3 + _parseLink3.Length))
|
|---|
| 1034 | ''' End If
|
|---|
| 1035 |
|
|---|
| 1036 | ''' 'Imageの取得
|
|---|
| 1037 | ''' If imgKeys.Contains(lItem.ImageUrl) = False Then
|
|---|
| 1038 | ''' imgKeys.Add(lItem.ImageUrl)
|
|---|
| 1039 | ''' ar(cnt) = _threadGetIcon.BeginInvoke(lItem.ImageUrl, Nothing, Nothing)
|
|---|
| 1040 | ''' 'retMsg = GetIconImage(lItem.ImageUrl, TIconList, TIconSmallList)
|
|---|
| 1041 | ''' 'If retMsg.Length > 0 Then
|
|---|
| 1042 | ''' ' Return retMsg
|
|---|
| 1043 | ''' 'End If
|
|---|
| 1044 | ''' End If
|
|---|
| 1045 |
|
|---|
| 1046 | ''' links.Add(lItem.Name + "_" + lItem.Id)
|
|---|
| 1047 | ''' tLine2.Add(lItem)
|
|---|
| 1048 | ''' Next
|
|---|
| 1049 |
|
|---|
| 1050 | ''' For cnt = 0 To ar.Length - 1
|
|---|
| 1051 | ''' If Not ar(cnt) Is Nothing Then
|
|---|
| 1052 | ''' Do While ar(cnt).IsCompleted = False
|
|---|
| 1053 | ''' System.Threading.Thread.Sleep(500)
|
|---|
| 1054 | ''' Loop
|
|---|
| 1055 | ''' End If
|
|---|
| 1056 | ''' Next
|
|---|
| 1057 |
|
|---|
| 1058 | Return ""
|
|---|
| 1059 | End Function
|
|---|
| 1060 |
|
|---|
| 1061 | Private Sub GetIconImage(ByVal pathUrl As String, ByVal imgKeys As Collections.Specialized.StringCollection, ByVal imgs As ImageList)
|
|---|
| 1062 | If _endingFlag Then Exit Sub
|
|---|
| 1063 | If _getIcon = False Then Exit Sub
|
|---|
| 1064 |
|
|---|
| 1065 | 'Dim pathUrlSmall As String = pathUrl.Replace("_normal.", "_mini.")
|
|---|
| 1066 | Dim resStatus As String = ""
|
|---|
| 1067 | '''Dim mySock = New MySocket("UTF-8")
|
|---|
| 1068 | Dim img As Image = Nothing
|
|---|
| 1069 | Dim cnt As Integer = 1
|
|---|
| 1070 |
|
|---|
| 1071 | '''img = mySock.GetWebResponse(pathUrl, resStatus, MySocket.REQ_TYPE.ReqGETBinary)
|
|---|
| 1072 | img = _mySock.GetWebResponse(pathUrl, resStatus, MySocket.REQ_TYPE.ReqGETBinary)
|
|---|
| 1073 | If Not img Is Nothing Then
|
|---|
| 1074 | '''SyncLock TIconList
|
|---|
| 1075 | imgKeys.Add(pathUrl)
|
|---|
| 1076 | imgs.Images.Add(pathUrl, img)
|
|---|
| 1077 | 'img.Dispose()
|
|---|
| 1078 | 'img = Nothing
|
|---|
| 1079 | '''End SyncLock
|
|---|
| 1080 | 'Exit Do
|
|---|
| 1081 | Else
|
|---|
| 1082 | 'If cnt > 10 Then Exit Sub
|
|---|
| 1083 | 'Threading.Thread.Sleep(200)
|
|---|
| 1084 | Exit Sub
|
|---|
| 1085 | End If
|
|---|
| 1086 |
|
|---|
| 1087 |
|
|---|
| 1088 | ''Dim img2 As Image = mySock.GetWebResponse(pathUrlSmall, resStatus, MySocket.REQ_TYPE.ReqGETBinary)
|
|---|
| 1089 |
|
|---|
| 1090 | ''If img2 Is Nothing Then
|
|---|
| 1091 | '' SyncLock TIconList
|
|---|
| 1092 | '' TIconList.Images.RemoveByKey(pathUrl)
|
|---|
| 1093 | '' End SyncLock
|
|---|
| 1094 | ''Else
|
|---|
| 1095 | ''If _iconSz <> 48 Then
|
|---|
| 1096 | 'If _iconSz <> 0 Then
|
|---|
| 1097 | ' Dim img2 As New Bitmap(_iconSz, _iconSz)
|
|---|
| 1098 | ' Dim g As Graphics = Graphics.FromImage(img2)
|
|---|
| 1099 | ' g.InterpolationMode = Drawing2D.InterpolationMode.Default
|
|---|
| 1100 | ' g.DrawImage(img, 0, 0, _iconSz, _iconSz)
|
|---|
| 1101 | ' '''SyncLock TIconSmallList
|
|---|
| 1102 | ' TIconSmallList.Images.Add(pathUrl, img2)
|
|---|
| 1103 | ' '''End SyncLock
|
|---|
| 1104 | 'End If
|
|---|
| 1105 | ''Else
|
|---|
| 1106 | '' Dim img2 As Image = img.Clone
|
|---|
| 1107 | '' '''SyncLock TIconSmallList
|
|---|
| 1108 | '' TIconSmallList.Images.Add(pathUrl, img2)
|
|---|
| 1109 | '' '''End SyncLock
|
|---|
| 1110 | ''End If
|
|---|
| 1111 | ''End If
|
|---|
| 1112 | ''''mySock = Nothing
|
|---|
| 1113 | End Sub
|
|---|
| 1114 |
|
|---|
| 1115 | Private Function GetAuthKey(ByVal resMsg As String) As Integer
|
|---|
| 1116 | Dim pos1 As Integer
|
|---|
| 1117 | Dim pos2 As Integer
|
|---|
| 1118 |
|
|---|
| 1119 | pos1 = resMsg.IndexOf(_getAuthKey)
|
|---|
| 1120 | If pos1 < 0 Then
|
|---|
| 1121 | 'データ不正?
|
|---|
| 1122 | Return -7
|
|---|
| 1123 | End If
|
|---|
| 1124 | pos2 = resMsg.IndexOf(_getAuthKeyTo, pos1 + _getAuthKey.Length)
|
|---|
| 1125 | If pos2 > -1 Then
|
|---|
| 1126 | _authKey = resMsg.Substring(pos1 + _getAuthKey.Length, pos2 - pos1 - _getAuthKey.Length)
|
|---|
| 1127 | Else
|
|---|
| 1128 | Return -7
|
|---|
| 1129 | End If
|
|---|
| 1130 |
|
|---|
| 1131 | Return 0
|
|---|
| 1132 | End Function
|
|---|
| 1133 |
|
|---|
| 1134 | Private Function GetAuthKeyDM(ByVal resMsg As String) As Integer
|
|---|
| 1135 | Dim pos1 As Integer
|
|---|
| 1136 | Dim pos2 As Integer
|
|---|
| 1137 |
|
|---|
| 1138 | pos1 = resMsg.IndexOf(_getAuthKey)
|
|---|
| 1139 | If pos1 < 0 Then
|
|---|
| 1140 | 'データ不正?
|
|---|
| 1141 | Return -7
|
|---|
| 1142 | End If
|
|---|
| 1143 | pos2 = resMsg.IndexOf("""", pos1 + _getAuthKey.Length)
|
|---|
| 1144 | _authKeyDM = resMsg.Substring(pos1 + _getAuthKey.Length, pos2 - pos1 - _getAuthKey.Length)
|
|---|
| 1145 |
|
|---|
| 1146 | Return 0
|
|---|
| 1147 | End Function
|
|---|
| 1148 |
|
|---|
| 1149 | Public Function PostStatus(ByVal postStr As String, ByVal reply_to As Integer) As String
|
|---|
| 1150 | '140文字まで。Byteで計算する必要有?
|
|---|
| 1151 | 'If postStr.Length > 140 Then
|
|---|
| 1152 | ' Return "PostStatus -> Err: 文字数オーバー"
|
|---|
| 1153 | 'End If
|
|---|
| 1154 |
|
|---|
| 1155 | If _endingFlag Then Return ""
|
|---|
| 1156 |
|
|---|
| 1157 | postStr = postStr.Trim()
|
|---|
| 1158 |
|
|---|
| 1159 | 'If _useAPI = False Then
|
|---|
| 1160 | ''データ部分の生成
|
|---|
| 1161 | 'Dim dataStr As String = _authKeyHeader + HttpUtility.UrlEncode(_authKey) + "&" + _authKeyHeader + HttpUtility.UrlEncode(_authKey) + "&siv=" + HttpUtility.UrlEncode(_authSiv) + "&" + _statusHeader + HttpUtility.UrlEncode(postStr)
|
|---|
| 1162 | 'Dim resStatus As String = ""
|
|---|
| 1163 | 'Dim resMsg As String = _mySock.GetWebResponse("https://" + _hubServer + _statusUpdatePath, resStatus, MySocket.REQ_TYPE.ReqPOSTEncodeProtoVer1, dataStr)
|
|---|
| 1164 |
|
|---|
| 1165 | 'If resStatus.StartsWith("OK") Then
|
|---|
| 1166 | ' If postStr.Trim.StartsWith("D ") = False Then
|
|---|
| 1167 | ' If resMsg.StartsWith("new Insertion.Top") = False Then
|
|---|
| 1168 | ' If resMsg.Contains("<p>") And resMsg.Contains("<\/p>") Then
|
|---|
| 1169 | ' Dim pos1 As Integer = resMsg.IndexOf("<p>", 0)
|
|---|
| 1170 | ' Dim pos2 As Integer = resMsg.IndexOf("<\/p>")
|
|---|
| 1171 | ' resMsg = resMsg.Substring(pos1 + 3, pos2 - pos1 - 3)
|
|---|
| 1172 | ' resMsg = HttpUtility.UrlDecode(resMsg.Replace("\u", "%u"))
|
|---|
| 1173 | ' If resMsg.Contains("140") Then
|
|---|
| 1174 | ' resStatus = ""
|
|---|
| 1175 | ' Else
|
|---|
| 1176 | ' resStatus = resMsg
|
|---|
| 1177 | ' End If
|
|---|
| 1178 | ' Else
|
|---|
| 1179 | ' resStatus = ""
|
|---|
| 1180 | ' End If
|
|---|
| 1181 | ' Else
|
|---|
| 1182 | ' resStatus = ""
|
|---|
| 1183 | ' End If
|
|---|
| 1184 | ' Else
|
|---|
| 1185 | ' If resMsg.Contains("<p>") And resMsg.Contains("<\/p>") Then
|
|---|
| 1186 | ' Dim pos1 As Integer = resMsg.IndexOf("<p>", 0)
|
|---|
| 1187 | ' Dim pos2 As Integer = resMsg.IndexOf("<\/p>")
|
|---|
| 1188 | ' resMsg = resMsg.Substring(pos1 + 3, pos2 - pos1 - 3)
|
|---|
| 1189 | ' resMsg = HttpUtility.UrlDecode(resMsg.Replace("\u", "%u"))
|
|---|
| 1190 | ' If resMsg = "Your direct message has been sent." Or resMsg = "ダイレクトメッセージを送信しました。" Then
|
|---|
| 1191 | ' resStatus = ""
|
|---|
| 1192 | ' Else
|
|---|
| 1193 | ' resStatus = resMsg
|
|---|
| 1194 | ' End If
|
|---|
| 1195 | ' End If
|
|---|
| 1196 | ' End If
|
|---|
| 1197 | 'End If
|
|---|
| 1198 |
|
|---|
| 1199 | 'Return resStatus
|
|---|
| 1200 | 'Else
|
|---|
| 1201 | 'データ部分の生成
|
|---|
| 1202 | Dim dataStr As String
|
|---|
| 1203 | If reply_to = 0 Then
|
|---|
| 1204 | dataStr = _statusHeader + HttpUtility.UrlEncode(postStr) + "&source=Tween"
|
|---|
| 1205 | Else
|
|---|
| 1206 | dataStr = _statusHeader + HttpUtility.UrlEncode(postStr) + "&source=Tween" + "&in_reply_to_status_id=" + HttpUtility.UrlEncode(reply_to.ToString)
|
|---|
| 1207 | End If
|
|---|
| 1208 |
|
|---|
| 1209 | Dim resStatus As String = ""
|
|---|
| 1210 | Dim resMsg As String = _mySock.GetWebResponse("https://" + _hubServer + _statusUpdatePathAPI, resStatus, MySocket.REQ_TYPE.ReqPOSTAPI, dataStr)
|
|---|
| 1211 |
|
|---|
| 1212 | If resStatus.StartsWith("OK") Then
|
|---|
| 1213 | Return ""
|
|---|
| 1214 | Else
|
|---|
| 1215 | Return resStatus
|
|---|
| 1216 | End If
|
|---|
| 1217 | 'End If
|
|---|
| 1218 |
|
|---|
| 1219 | ''********************** POST失敗時応答判定 ***********************
|
|---|
| 1220 | ''DM送信
|
|---|
| 1221 | 'If resMsg.IndexOf("Can't find that person") > -1 Then
|
|---|
| 1222 | ' Return "PostStatus -> Err: DM宛先間違い"
|
|---|
| 1223 | 'End If
|
|---|
| 1224 | ''*****************************************************************
|
|---|
| 1225 | End Function
|
|---|
| 1226 |
|
|---|
| 1227 | Public Function RemoveStatus(ByVal id As String) As String
|
|---|
| 1228 | If _endingFlag Then Return ""
|
|---|
| 1229 |
|
|---|
| 1230 | 'データ部分の生成
|
|---|
| 1231 | 'Dim dataStr As String = "_method=delete&" + _authKeyHeader + HttpUtility.UrlEncode(_authKey)
|
|---|
| 1232 | Dim dataStr As String = _authKeyHeader + HttpUtility.UrlEncode(_authKey)
|
|---|
| 1233 | Dim resStatus As String = ""
|
|---|
| 1234 | Dim resMsg As String = _mySock.GetWebResponse("https://" + _hubServer + _StDestroyPath + id, resStatus, MySocket.REQ_TYPE.ReqPOSTEncode, dataStr, "https://" + _baseUrlStr + _homePath)
|
|---|
| 1235 |
|
|---|
| 1236 | If resMsg.StartsWith("<html>") = False Then
|
|---|
| 1237 | Return resStatus
|
|---|
| 1238 | End If
|
|---|
| 1239 |
|
|---|
| 1240 | '********************** POST失敗時応答判定 ***********************
|
|---|
| 1241 | '*****************************************************************
|
|---|
| 1242 |
|
|---|
| 1243 | Return ""
|
|---|
| 1244 | End Function
|
|---|
| 1245 |
|
|---|
| 1246 | Public Function RemoveDirectMessage(ByVal id As String) As String
|
|---|
| 1247 | If _endingFlag Then Return ""
|
|---|
| 1248 |
|
|---|
| 1249 | 'データ部分の生成
|
|---|
| 1250 | Dim dataStr As String = _authKeyHeader + HttpUtility.UrlEncode(_authKey)
|
|---|
| 1251 | Dim resStatus As String = ""
|
|---|
| 1252 | Dim resMsg As String = _mySock.GetWebResponse("https://" + _hubServer + _DMDestroyPath + id, resStatus, MySocket.REQ_TYPE.ReqPOST, dataStr)
|
|---|
| 1253 |
|
|---|
| 1254 | If resMsg.StartsWith("<html>") = False Then
|
|---|
| 1255 | Return resStatus
|
|---|
| 1256 | End If
|
|---|
| 1257 |
|
|---|
| 1258 | '********************** GET失敗時応答判定 ***********************
|
|---|
| 1259 | '*****************************************************************
|
|---|
| 1260 |
|
|---|
| 1261 | Return ""
|
|---|
| 1262 | End Function
|
|---|
| 1263 |
|
|---|
| 1264 | Public Function PostFavAdd(ByVal id As String) As String
|
|---|
| 1265 | If _endingFlag Then Return ""
|
|---|
| 1266 |
|
|---|
| 1267 | 'データ部分の生成
|
|---|
| 1268 | Dim dataStr As String = _authKeyHeader + HttpUtility.UrlEncode(_authKey)
|
|---|
| 1269 | Dim resStatus As String = ""
|
|---|
| 1270 | Dim resMsg As String = _mySock.GetWebResponse("https://" + _hubServer + _postFavAddPath + id, resStatus, MySocket.REQ_TYPE.ReqPOSTEncodeProtoVer2, dataStr)
|
|---|
| 1271 |
|
|---|
| 1272 | If resMsg.StartsWith("$") = False Then
|
|---|
| 1273 | Return resStatus
|
|---|
| 1274 | End If
|
|---|
| 1275 |
|
|---|
| 1276 | '********************** POST失敗時判定 ***********************
|
|---|
| 1277 | '*************************************************************
|
|---|
| 1278 |
|
|---|
| 1279 | Return ""
|
|---|
| 1280 | End Function
|
|---|
| 1281 |
|
|---|
| 1282 | Public Function PostFavRemove(ByVal id As String) As String
|
|---|
| 1283 | If _endingFlag Then Return ""
|
|---|
| 1284 |
|
|---|
| 1285 | 'データ部分の生成
|
|---|
| 1286 | Dim dataStr As String = _authKeyHeader + HttpUtility.UrlEncode(_authKey)
|
|---|
| 1287 | Dim resStatus As String = ""
|
|---|
| 1288 | Dim resMsg As String = _mySock.GetWebResponse("https://" + _hubServer + _postFavRemovePath + id, resStatus, MySocket.REQ_TYPE.ReqPOSTEncodeProtoVer2, dataStr)
|
|---|
| 1289 |
|
|---|
| 1290 | If resMsg.StartsWith("$") = False Then
|
|---|
| 1291 | Return resStatus
|
|---|
| 1292 | End If
|
|---|
| 1293 |
|
|---|
| 1294 | '********************** POST失敗時判定 ***********************
|
|---|
| 1295 | '*************************************************************
|
|---|
| 1296 |
|
|---|
| 1297 | Return ""
|
|---|
| 1298 | End Function
|
|---|
| 1299 |
|
|---|
| 1300 | Public Property Username()
|
|---|
| 1301 | Get
|
|---|
| 1302 | Return _uid
|
|---|
| 1303 | End Get
|
|---|
| 1304 | Set(ByVal value)
|
|---|
| 1305 | _uid = value
|
|---|
| 1306 | _mySock.Username = _uid
|
|---|
| 1307 | End Set
|
|---|
| 1308 | End Property
|
|---|
| 1309 |
|
|---|
| 1310 | Public Property Password()
|
|---|
| 1311 | Get
|
|---|
| 1312 | Return _pwd
|
|---|
| 1313 | End Get
|
|---|
| 1314 | Set(ByVal value)
|
|---|
| 1315 | _pwd = value
|
|---|
| 1316 | _mySock.Password = _pwd
|
|---|
| 1317 | _mySock.CreateCredentialInfo()
|
|---|
| 1318 | End Set
|
|---|
| 1319 | End Property
|
|---|
| 1320 |
|
|---|
| 1321 | 'Public Property LastID() As String
|
|---|
| 1322 | ' Get
|
|---|
| 1323 | ' Return _lastId
|
|---|
| 1324 | ' End Get
|
|---|
| 1325 | ' Set(ByVal value As String)
|
|---|
| 1326 | ' _lastId = value
|
|---|
| 1327 | ' End Set
|
|---|
| 1328 | 'End Property
|
|---|
| 1329 |
|
|---|
| 1330 | 'Public Property LastName() As String
|
|---|
| 1331 | ' Get
|
|---|
| 1332 | ' Return _lastName
|
|---|
| 1333 | ' End Get
|
|---|
| 1334 | ' Set(ByVal value As String)
|
|---|
| 1335 | ' _lastName = value
|
|---|
| 1336 | ' End Set
|
|---|
| 1337 | 'End Property
|
|---|
| 1338 |
|
|---|
| 1339 | Public Property NextThreshold() As Integer
|
|---|
| 1340 | Get
|
|---|
| 1341 | Return _nextThreshold
|
|---|
| 1342 | End Get
|
|---|
| 1343 | Set(ByVal value As Integer)
|
|---|
| 1344 | _nextThreshold = value
|
|---|
| 1345 | End Set
|
|---|
| 1346 | End Property
|
|---|
| 1347 |
|
|---|
| 1348 | Public Property NextPages() As Integer
|
|---|
| 1349 | Get
|
|---|
| 1350 | Return _nextPages
|
|---|
| 1351 | End Get
|
|---|
| 1352 | Set(ByVal value As Integer)
|
|---|
| 1353 | _nextPages = value
|
|---|
| 1354 | End Set
|
|---|
| 1355 | End Property
|
|---|
| 1356 |
|
|---|
| 1357 | 'Public Property IconSize() As Integer
|
|---|
| 1358 | ' Get
|
|---|
| 1359 | ' Return _iconSz
|
|---|
| 1360 | ' End Get
|
|---|
| 1361 | ' Set(ByVal value As Integer)
|
|---|
| 1362 | ' _iconSz = value
|
|---|
| 1363 | ' End Set
|
|---|
| 1364 | 'End Property
|
|---|
| 1365 |
|
|---|
| 1366 | Public Property Ending() As Boolean
|
|---|
| 1367 | Get
|
|---|
| 1368 | Return _endingFlag
|
|---|
| 1369 | End Get
|
|---|
| 1370 | Set(ByVal value As Boolean)
|
|---|
| 1371 | _endingFlag = value
|
|---|
| 1372 | End Set
|
|---|
| 1373 | End Property
|
|---|
| 1374 |
|
|---|
| 1375 | Public ReadOnly Property InfoTwitter() As String
|
|---|
| 1376 | Get
|
|---|
| 1377 | Return _infoTwitter
|
|---|
| 1378 | End Get
|
|---|
| 1379 | End Property
|
|---|
| 1380 |
|
|---|
| 1381 | Public Property UseAPI() As Boolean
|
|---|
| 1382 | Get
|
|---|
| 1383 | Return _useAPI
|
|---|
| 1384 | End Get
|
|---|
| 1385 | Set(ByVal value As Boolean)
|
|---|
| 1386 | _useAPI = value
|
|---|
| 1387 | End Set
|
|---|
| 1388 | End Property
|
|---|
| 1389 |
|
|---|
| 1390 | Public Property HubServer() As String
|
|---|
| 1391 | Get
|
|---|
| 1392 | Return _hubServer
|
|---|
| 1393 | End Get
|
|---|
| 1394 | Set(ByVal value As String)
|
|---|
| 1395 | _hubServer = value
|
|---|
| 1396 | End Set
|
|---|
| 1397 | End Property
|
|---|
| 1398 |
|
|---|
| 1399 | Public Sub GetWedata()
|
|---|
| 1400 | Dim resStatus As String = ""
|
|---|
| 1401 | Dim resMsg As String = ""
|
|---|
| 1402 |
|
|---|
| 1403 | resMsg = _mySock.GetWebResponse(wedataUrl, resStatus, timeout:=10 * 1000) 'タイムアウト時間を10秒に設定
|
|---|
| 1404 | If resMsg.Length = 0 Then Exit Sub
|
|---|
| 1405 |
|
|---|
| 1406 | Dim rs As New System.IO.StringReader(resMsg)
|
|---|
| 1407 |
|
|---|
| 1408 | 'StreamReaderを使うと次のようになる
|
|---|
| 1409 | 'Dim ms As New System.IO.MemoryStream( _
|
|---|
| 1410 | ' System.Text.Encoding.UTF8.GetBytes(TextBox1.Text))
|
|---|
| 1411 | 'Dim rs As New System.IO.StreamReader(ms)
|
|---|
| 1412 |
|
|---|
| 1413 | Dim mode As Integer = 0 '0:search name 1:search data 2:read data
|
|---|
| 1414 | Dim name As String = ""
|
|---|
| 1415 |
|
|---|
| 1416 | 'ストリームの末端まで繰り返す
|
|---|
| 1417 | Dim ln As String
|
|---|
| 1418 | While rs.Peek() > -1
|
|---|
| 1419 | ln = rs.ReadLine
|
|---|
| 1420 |
|
|---|
| 1421 | Select Case mode
|
|---|
| 1422 | Case 0
|
|---|
| 1423 | If ln.StartsWith(" ""name"": ") Then
|
|---|
| 1424 | name = ln.Substring(13, ln.Length - 2 - 13)
|
|---|
| 1425 | mode += 1
|
|---|
| 1426 | End If
|
|---|
| 1427 | Case 1
|
|---|
| 1428 | If ln = " ""data"": {" Then
|
|---|
| 1429 | mode += 1
|
|---|
| 1430 | End If
|
|---|
| 1431 | Case 2
|
|---|
| 1432 | If ln = " }," Then
|
|---|
| 1433 | mode = 0
|
|---|
| 1434 | Else
|
|---|
| 1435 | If ln.EndsWith(",") Then ln = ln.Substring(0, ln.Length - 1)
|
|---|
| 1436 | Select Case name
|
|---|
| 1437 | Case "SplitPostReply"
|
|---|
| 1438 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1439 | _splitPost = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1440 | End If
|
|---|
| 1441 | Case "SplitPostRecent"
|
|---|
| 1442 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1443 | _splitPostRecent = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1444 | End If
|
|---|
| 1445 | Case "StatusID"
|
|---|
| 1446 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1447 | _statusIdTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1448 | End If
|
|---|
| 1449 | Case "IsProtect"
|
|---|
| 1450 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1451 | _isProtect = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1452 | End If
|
|---|
| 1453 | Case "IsReply"
|
|---|
| 1454 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1455 | _isReplyEng = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1456 | End If
|
|---|
| 1457 | If ln.StartsWith(" ""tagfrom2"": """) Then
|
|---|
| 1458 | _isReplyJpn = ln.Substring(19, ln.Length - 1 - 19).Replace("\", "")
|
|---|
| 1459 | End If
|
|---|
| 1460 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1461 | _isReplyTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1462 | End If
|
|---|
| 1463 | Case "GetStar"
|
|---|
| 1464 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1465 | _parseStar = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1466 | End If
|
|---|
| 1467 | If ln.StartsWith(" ""tagfrom2"": """) Then
|
|---|
| 1468 | _parseStarEmpty = ln.Substring(19, ln.Length - 1 - 19).Replace("\", "")
|
|---|
| 1469 | End If
|
|---|
| 1470 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1471 | _parseStarTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1472 | End If
|
|---|
| 1473 | Case "Follower"
|
|---|
| 1474 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1475 | _followerList = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1476 | End If
|
|---|
| 1477 | If ln.StartsWith(" ""tagfrom2"": """) Then
|
|---|
| 1478 | _followerMbr1 = ln.Substring(19, ln.Length - 1 - 19).Replace("\", "")
|
|---|
| 1479 | End If
|
|---|
| 1480 | If ln.StartsWith(" ""tagfrom3"": """) Then
|
|---|
| 1481 | _followerMbr2 = ln.Substring(19, ln.Length - 1 - 19).Replace("\", "")
|
|---|
| 1482 | End If
|
|---|
| 1483 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1484 | _followerMbr3 = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1485 | End If
|
|---|
| 1486 | Case "SplitDM"
|
|---|
| 1487 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1488 | _splitDM = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1489 | End If
|
|---|
| 1490 | Case "GetMsgDM"
|
|---|
| 1491 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1492 | _parseDM1 = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1493 | End If
|
|---|
| 1494 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1495 | _parseDM2 = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1496 | End If
|
|---|
| 1497 | Case "GetDate"
|
|---|
| 1498 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1499 | _parseDate = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1500 | End If
|
|---|
| 1501 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1502 | _parseDateTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1503 | End If
|
|---|
| 1504 | Case "GetMsg"
|
|---|
| 1505 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1506 | _parseMsg1 = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1507 | End If
|
|---|
| 1508 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1509 | _parseMsg2 = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1510 | End If
|
|---|
| 1511 | Case "GetImagePath"
|
|---|
| 1512 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1513 | _parseImg = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1514 | End If
|
|---|
| 1515 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1516 | _parseImgTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1517 | End If
|
|---|
| 1518 | Case "GetNick"
|
|---|
| 1519 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1520 | _parseNick = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1521 | End If
|
|---|
| 1522 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1523 | _parseNickTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1524 | End If
|
|---|
| 1525 | Case "GetName"
|
|---|
| 1526 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1527 | _parseName = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1528 | End If
|
|---|
| 1529 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1530 | _parseNameTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1531 | End If
|
|---|
| 1532 | 'Case "GetSiv"
|
|---|
| 1533 | ' If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1534 | ' _getSiv = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1535 | ' End If
|
|---|
| 1536 | ' If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1537 | ' _getSivTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1538 | ' End If
|
|---|
| 1539 | Case "AuthKey"
|
|---|
| 1540 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1541 | _getAuthKey = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1542 | End If
|
|---|
| 1543 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1544 | _getAuthKeyTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1545 | End If
|
|---|
| 1546 | Case "InfoTwitter"
|
|---|
| 1547 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1548 | _getInfoTwitter = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1549 | End If
|
|---|
| 1550 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1551 | _getInfoTwitterTo = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1552 | End If
|
|---|
| 1553 | Case "GetProtectMsg"
|
|---|
| 1554 | If ln.StartsWith(" ""tagfrom"": """) Then
|
|---|
| 1555 | _parseProtectMsg1 = ln.Substring(18, ln.Length - 1 - 18).Replace("\", "")
|
|---|
| 1556 | End If
|
|---|
| 1557 | If ln.StartsWith(" ""tagto"": """) Then
|
|---|
| 1558 | _parseProtectMsg2 = ln.Substring(16, ln.Length - 1 - 16).Replace("\", "")
|
|---|
| 1559 | End If
|
|---|
| 1560 | End Select
|
|---|
| 1561 | End If
|
|---|
| 1562 | End Select
|
|---|
| 1563 | End While
|
|---|
| 1564 |
|
|---|
| 1565 | rs.Close()
|
|---|
| 1566 |
|
|---|
| 1567 | End Sub
|
|---|
| 1568 |
|
|---|
| 1569 | Public WriteOnly Property GetIcon() As Boolean
|
|---|
| 1570 | Set(ByVal value As Boolean)
|
|---|
| 1571 | _getIcon = value
|
|---|
| 1572 | End Set
|
|---|
| 1573 | End Property
|
|---|
| 1574 |
|
|---|
| 1575 | Public WriteOnly Property TinyUrlResolve() As Boolean
|
|---|
| 1576 | Set(ByVal value As Boolean)
|
|---|
| 1577 | _tinyUrlResolve = value
|
|---|
| 1578 | End Set
|
|---|
| 1579 | End Property
|
|---|
| 1580 |
|
|---|
| 1581 | Public Sub CreateNewSocket()
|
|---|
| 1582 | _mySock = Nothing
|
|---|
| 1583 | _mySock = New MySocket("UTF-8", Username, Password)
|
|---|
| 1584 | _signed = False
|
|---|
| 1585 | End Sub
|
|---|
| 1586 | End Class
|
|---|