Script to backup and move posts from steemit to another blogging platform

Post your working scripts, libraries and tools
nilsonrdg
Posts: 15
Joined: 16 Feb 2017, 16:05
Location: Brazil
Contact:

Script to backup and move posts from steemit to another blogging platform

15 Mar 2019, 08:13

This script allows you to backup and move steemit posts to another blogging platform (blogspot or wordpress, for example).

Maybe because you want to monetize your content longer, or because steemit is not really a good blogging platform (it isn't easy for visitor navigate through blog posts, or see a list of links of posts, or widgets, statistics etc.

To use the script you need to do the following:

1 - Change the variable: BlogUrl

2 - Press "Control Alt i" to initiate the script

3 - Insert new blog content:

Control Alt T => to paste post title (para inserir o título da postagem)
Control Alt V => to paste post content (para colar o text da postagem)
Control Alt K => to paste tags (para inserir as palavras chave)
Control Alt R => to reload (para recarregar)


Code: Select all


; Change to the blog new post URL | Mude para o endereço para inserir novo post do blog
BlogUrl=yourblognewposturl

/*

This script is useful if you want to post your best steemit posts to other place, maybe where you can monetize it for longer.
It also backups your posts.

Este script é útil se você quer postar seus melhores posts do steemit em outro lugar, talvez onde você pode monetizá-lo por mais tempo.
Ele também faz backups dos seus posts.

*/

/*

Hotkeys (Atalhos):

Control Alt V => to paste post content (para colar o text da postagem)
Control Alt T => to insert post title (para inserir o título da postagem)
Control Alt K => to insert tags (para inserir as palavras chave)
Control Alt R => to reload (para recarregar)

*/


HotKeys=
(
Hotkeys (Atalhos):

Control Alt V => to paste post content (para colar o text da postagem)
Control Alt T => to insert post title (para inserir o título da postagem)
Control Alt K => to insert tags (para inserir as palavras chave)
Control Alt R => to reload (para recarregar)
)

tooltip, ...`nPress "Control Alt i" to initiate the script`n`nPressione "Control Alt i" para iniciar o script`n, 480,250
sleep, 8000
tooltip,

^!i::
tooltip, ...`nCopy the steemit post URL!`n`nCopie o endereço da postagem!`n, 480,250

Clipboard=

Clipwait

SteemitURL := Clipboard

FileName:=RegExReplace(SteemitURL,".+\/","")

Link = <br><i><a href="%SteemitURL%"  target="%FileName%">Veja também no Steemit</a></i><br><br>

tooltip, Wait`, ...`nwhile the post is loaded...`n`nAguarde enquanto o post é carregado..., 480,250

; Creates an Internet Explore COM object
ie := ComObjCreate("InternetExplorer.Application")

; Navigate to a website
ie.navigate(SteemitURL)

; This ensures the webpage completely loads before doing anything else
while ie.ReadyState != 4
	Sleep, 100

; Shows the actual internet explorer window
ie.visible := true


htmlTagsFull := ie.document.getElementsByClassName("TagList__horizontal")[0].innerHTML
TagsSteem := RegExReplace(htmlTagsFull, "<.+?>", ",")
TagsSteem := RegExReplace(TagsSteem, "^\,", "")

PageTitle := ie.document.getElementsByTagName("title")[0].innerHTML

TagsSteem:=RegExReplace(TagsSteem,"\s","")
TagsSteem:=RegExReplace(TagsSteem,"\,+",",")


PageTitle := RegExReplace(PageTitle,"— Steemit","")

FileContents := ie.document.getElementsByClassName("PostFull__body entry-content")[0].innerHTML

FileContents = %FileContents%%Link%

FileContents := RegExReplace(FileContents,"title=""This link will take you away from steemit.com""","target='_blank'")

FileContents := RegEXReplace(FileContents,"class=""MarkdownViewer Markdown""","")
FileContents := RegEXReplace(FileContents,"rel=""nofollow noopener""","")

FileContents := RegEXReplace(FileContents,"<div >","<div>")
FileContents := RegEXReplace(FileContents,"class=""text-justify""","align='justify'")
FileContents := RegEXReplace(FileContents,"class=""pull-left""","align='center'")
FileContents := RegEXReplace(FileContents,"class=""pull-right""","align='center'")
FileContents := RegEXReplace(FileContents,"class=""text-center""","align='center'")



StringReplace, FileContents, FileContents,<center>,<center>, UseErrorLevel
Occurrences01 = %ErrorLevel%
StringReplace, FileContents, FileContents,</center>,</center>, UseErrorLevel
Occurrences02 = %ErrorLevel%

if (Occurrences01=Occurrences02 and Occurrences01<>0 and Occurrences02<>0)
{
FileContents := RegEXReplace(FileContents,"<center>","<div align='center'>")
FileContents := RegEXReplace(FileContents,"</center>","</div>")

;msgbox, Center tags replaced by Div tags - %Occurrences02% of %Occurrences01%
tooltip, ...`nCenter tags replaced by Div tags - %Occurrences02% of %Occurrences01%
sleep, 1000
}


; Removing special characters that windows doesn't allow in file names
FileName := RegExReplace(PageTitle,"\:|\*|\/|\||\\|<|>|""|\?","")
PreviewFile = %A_ScriptDir%/%FileName%.htm

if FileExist(PreviewFile)
{
msgbox, File exists! Script will be restarted!
ie.quit
reload
}


FileAppend, %PageTitle%`n`r`n`r%FileContents%, %PreviewFile%

; Quits out of the application.
ie.quit


tooltip, => Press Esc to skip this note`n`n%HotKeys%`n,300,100
keywait, Esc, D
tooltip,


;MsgBox, 4,, Would you like to open the blog editor? (press Yes or No)
;IfMsgBox Yes
run, %BlogURL%

return


^!T::
Clipboard := PageTitle
send ^v
tooltip,
return


^!v::
Clipboard := FileContents
send ^v
return


^!K::

InputBox, UserInput, HotKeys, Edit the tags, , 640, 200,,,,,%TagsSteem%

Clipboard = %UserInput%

send, ^v
return

^!R::
reload
return



; Hotkeys for editing the code if it is needed

^!m::
send, <!--more-->
return

^!j::
send, <div align="justify">
return

^!b::
send, target="_Blank"
return


Return to “Scripts and Functions”

Who is online

Users browsing this forum: digidings and 47 guests