Automated Blog Article Posting on Web 2.0 VBNET
ONLY VBNET!
куплю PRIVATE SUBs
сделать по такому приципу на другие сайты
http://hubpages.com/hubtool/create/name/
http://linux-installation-info.wetpaint.com/page/how+to+convert+linux+to+unix+crap
сколько стоит 1 SUB()?
example
Private Sub weblogposter(Optional ByVal updater As Boolean = False)
On Error Resume Next
weblogbusy = True
Dim url As String = webweblog.Document.Url.ToString
log("weblog here " & url)
If weblogupdated = True Then GoTo updated
If updater = True Then GoTo update
If InStr(url, "weblog.com/wp-login.php") > 0 Then GoTo login
If InStr(url, "weblog.com/wp-admin/post-new.php") > 0 Then GoTo post
If InStr(url, "post.php?action=edit&post=") > 0 Then GoTo posted
If InStr(url, "weblog.com/wp-admin/") > 0 Then GoTo dashboard
login:
webweblog.Document.All("log").SetAttribute("value", "exxxxxx")
webweblog.Document.All("pwd").SetAttribute("value", "ifxxxxxxxxxxx")
webweblog.Document.All("wp-submit").InvokeMember("click")
GoTo ender
dashboard:
'webweblog.Navigate("http://efiman38.weblog.com/wp-admin/post-new.php")
For i = 0 To webweblog.Document.Body.GetElementsByTagName("A").Count - 1
If InStr(webweblog.Document.Body.GetElementsByTagName("A").Item(i).InnerText, "New Post") > 0 Then
webweblog.Document.Body.GetElementsByTagName("A").Item(i).InvokeMember("click")
'webloglink = webweblog.Document.Body.GetElementsByTagName("A").Item(i).GetAttribute("HREF")
'log("found weblog link to post ! " & webloglink)
Exit For
End If
Next
GoTo ender
post:
webweblog.Document.All("post_title").SetAttribute("value", current_article_h1_innerhtml)
webweblog.Document.All("content").SetAttribute("value", current_article_innerhtml)
webweblog.Document.All("publish").InvokeMember("click")
GoTo ender
posted:
If InStr(url, "&message=6") > 0 Then
log("weblog; first post, just getting link for linkwheel,")
For i = 0 To webweblog.Document.Body.GetElementsByTagName("A").Count - 1
If InStr(webweblog.Document.Body.GetElementsByTagName("A").Item(i).InnerText, "View post") > 0 Then
'webweblog.Document.Body.GetElementsByTagName("A").Item(i).InvokeMember("click")
webloglink = webweblog.Document.Body.GetElementsByTagName("A").Item(i).GetAttribute("HREF")
log("found weblog posted link! " & webloglink & ";now waiting and updating to insert linkweehl for LJ=" & ljlink)
txtweb20links.Text = webloglink & vbCrLf & txtweb20links.Text
weblogready = True
Exit For
End If
Next
End If
If InStr(url, "&message=1") Then
log("updated weblog post with LJ linkwheel link inside of it, doing nothing")
End If
update:
log("weblog;timer says that LJ did post link, and weblog can be updated with lj link=" & ljlink)
webweblog.Document.All("post_title").SetAttribute("value", current_article_h1_innerhtml)
webweblog.Document.All("content").SetAttribute("value", "" & ljlink & "
" & current_article_innerhtml)
webweblog.Document.All("save").InvokeMember("click")
updater = False
weblogupdated = True
GoTo ender
updated:
log("weblog: weblog post was updated with linkwheel, lets go to dashboard, and wait new posts,")
For i = 0 To webweblog.Document.Body.GetElementsByTagName("A").Count - 1
If InStr(webweblog.Document.Body.GetElementsByTagName("A").Item(i).InnerText, "Dashboard") > 0 Then
webweblog.Document.Body.GetElementsByTagName("A").Item(i).InvokeMember("click")
Exit For
End If
Next
GoTo ender
ender:
Exit Sub
End Sub
Private Sub weblivejournal_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles weblivejournal.DocumentCompleted
'log("weblivejournal.ReadyState " & weblivejournal.ReadyState)
livejournalbusy = False
End Sub
Private Sub livejournalposter(Optional ByVal updater As Boolean = False)
On Error GoTo bug
livejournalbusy = True
Dim url As String
url = weblivejournal.Document.Url.ToString
log(url)
If livejournalupdated = True Then GoTo updated
If updater = True Then GoTo updating
If url = "http://www.livejournal.com/update.bml" Then GoTo post
If url = "http://www.livejournal.com/" Then GoTo dashboard
If url = "http://www.livejournal.com/login.bml" Then GoTo login
GoTo ender
login:
' MsgBox("lj")
log("LIVEJOURNAL: entry page, entering pass")
weblivejournal.Document.All("user").SetAttribute("value", "xxxxxxxxxx")
weblivejournal.Document.All("password").SetAttribute("value", "xxxx8R0")
weblivejournal.Document.All("action:login").InvokeMember("click")
GoTo ender
dashboard:
For i = 0 To weblivejournal.Document.Body.GetElementsByTagName("A").Count - 1
If InStr(weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).InnerText, "Post") > 0 Then
weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).InvokeMember("click")
Exit For
End If
Next
GoTo ender
post:
'log("lj posting page, start posting...")
If InStr(weblivejournal.Document.Body.InnerText, "Update successful.") > 0 Then
log("Livejournal:lj posted successfully. getting posted link...")
For i = 0 To weblivejournal.Document.Body.GetElementsByTagName("A").Count - 1
If InStr(weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).InnerText, "View the entry") > 0 Then
ljlink = weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).GetAttribute("HREF")
log("found LJ posted link! " & ljlink)
txtweb20links.Text = ljlink & vbCrLf & txtweb20links.Text
livejournalready = True
Exit For
End If
Next
log("Livejournal:Posted link,now i go to EDIT ENTRY")
For i = 0 To weblivejournal.Document.Body.GetElementsByTagName("A").Count - 1
If InStr(weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).InnerText, "Edit the entry") > 0 Then
weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).InvokeMember("click")
Exit For
End If
Next
Else
log("Livejournal: starting posting article into form...")
weblivejournal.Document.All("subject").SetAttribute("value", current_article_h1_innertext)
weblivejournal.Document.All("event").SetAttribute("value", current_article_innerhtml)
weblivejournal.Document.All("prop_taglist").SetAttribute("value", Replace(current_article_h1_innertext, " ", ",")) '
weblivejournal.Document.All("action:update").InvokeMember("click")
End If
GoTo ender
updating:
'editjournal.bml?journal=
log("livejournal: timer says its time to update LJ post with wordpress link=" & wordpresslink)
log("livejournal: LJ post was update with linkwheel, exit sub")
weblivejournal.Document.All("subject").SetAttribute("value", current_article_h1_innertext)
weblivejournal.Document.All("event").SetAttribute("value", "" & wordpresslink & "
" & current_article_innerhtml)
weblivejournal.Document.All("prop_taglist").SetAttribute("value", Replace(current_article_h1_innertext, " ", ",")) '
weblivejournal.Document.All("action:save").InvokeMember("click")
updater = False
livejournalupdated = True
GoTo ender
updated:
log("livejournal: LJ already updated with linkwheel, going to main page, lets do another link")
For i = 0 To weblivejournal.Document.Body.GetElementsByTagName("A").Count - 1
If InStr(weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).InnerText, "Home") > 0 Then
weblivejournal.Document.Body.GetElementsByTagName("A").Item(i).InvokeMember("click")
Exit For
End If
Next
GoTo ender
ender:
Exit Sub
bug:
log("LIVEJOURNAL:ERROR=" & ErrorToString())
Resume Next
End Sub