1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Spin content

Discussion in 'Visual Basic .NET' started by phil3627, Oct 28, 2010.

  1. phil3627

    phil3627 Registered Member

    Joined:
    Jan 22, 2009
    Messages:
    63
    Likes Received:
    2
    How do you spin content in visual basic? I searched google but found nothing. What I mean by spin content: {dog|puppy|pit bull} want to make a bot that spins and post articles.
     
    Last edited: Oct 28, 2010
  2. Dubbletoke

    Dubbletoke Regular Member

    Joined:
    May 4, 2010
    Messages:
    434
    Likes Received:
    88
    Occupation:
    Web Developer
    Location:
    Winter Haven, Florida
    are you talking about the code needed to make a text box/area where your able to produce spun content ?
     
  3. phil3627

    phil3627 Registered Member

    Joined:
    Jan 22, 2009
    Messages:
    63
    Likes Received:
    2
    No I'm talking about the code that takes my already spun content, spins it so that I can submit to sites like ezinearticles, hubpages, blogger.
     
    Last edited: Oct 29, 2010
  4. tacopalypse

    tacopalypse Executive VIP Jr. VIP Premium Member

    Joined:
    Nov 30, 2009
    Messages:
    980
    Likes Received:
    2,485
    Home Page:
  5. Kid Shaleen

    Kid Shaleen Regular Member

    Joined:
    Oct 29, 2009
    Messages:
    250
    Likes Received:
    63
    You'd do it pretty much the way you'd do it in any similar language.

    Open your spun file. Create an output file. Start reading the input file until you come to an opening "{" bracket. Send all the characters up to but not including the bracket to the output file.

    Then, begin counting the "|" characters until you come to the end "}" bracket. Add one to the count. Generate a random integer between 1 and the count. Go back to the opening bracket, starting to form a string until you get to the "|" character again. Pick the string the corresponds to the random number selected earlier.

    Send that string to your output file.

    Proceed as before, going through and looking for the next opening bracket, writing all the character up to the bracket to the output file. etc. etc.

    Save the output file.
     
  6. prometheussoft

    prometheussoft Newbie

    Joined:
    Jun 29, 2010
    Messages:
    41
    Likes Received:
    41
    Occupation:
    DBA
    Location:
    Kailua, HI
    Home Page:
    You can use this function to help generate random numbers
    Public Function RandomNumber(ByVal MaxNumber As Integer, Optional ByVal MinNumber As Integer = 0) As Integer
    Dim r As New Random()
    If MinNumber > MaxNumber Then
    Dim t As Integer = MinNumber
    MinNumber = MaxNumber
    MaxNumber = t
    End If
    Return r.Next(MinNumber, MaxNumber)
    End Function
     
  7. phil3627

    phil3627 Registered Member

    Joined:
    Jan 22, 2009
    Messages:
    63
    Likes Received:
    2
    I don't want to create articles from my spun content trying to create a bot that will log into sites like blogger spin my article and post it to blogger the same way senuke does.
     
  8. prometheussoft

    prometheussoft Newbie

    Joined:
    Jun 29, 2010
    Messages:
    41
    Likes Received:
    41
    Occupation:
    DBA
    Location:
    Kailua, HI
    Home Page:
    Well thats exactly what Kid Shaleen was trying to help you with. In order to spin the article you're going to have to parse the text and look for the brackets. When the program sees the brackets you're going to need to store those words that are seperate with "," into an array. Get the length of that array and then generate a random number that falls inside the arrays length. Once you have that number you can grab the nth word in the array and the that part is spun.
     
  9. dungto

    dungto Newbie

    Joined:
    Jan 1, 2009
    Messages:
    14
    Likes Received:
    5
    translate using G translate. for example english => french => german => back to english
     
  10. phil3627

    phil3627 Registered Member

    Joined:
    Jan 22, 2009
    Messages:
    63
    Likes Received:
    2
    So I have to do what Kid Shaleen wrote each time I want to auto post a new article to web 2.0 sites? If thats the case I'm better off buying ubot.
     
  11. prometheussoft

    prometheussoft Newbie

    Joined:
    Jun 29, 2010
    Messages:
    41
    Likes Received:
    41
    Occupation:
    DBA
    Location:
    Kailua, HI
    Home Page:
    Well..yeah...the vb program would run through that coded statement each time it spun an article...its not liking you're going to be writing this code for each article...and for the translation bit thats pretty easy as well....if you're not very savy with .net and vb you may be better off getting ubot...i wont knock it but I will say that i will pay itself over a thousand times if you take the time to learn vb and .net instead of going for ubot.
     
  12. zacatictac

    zacatictac Power Member

    Joined:
    May 2, 2010
    Messages:
    598
    Likes Received:
    755
    Occupation:
    SEO
    Location:
    Metaverse
    Merry Christmas.



    Code:
    Public Function Spin(ByVal SourceString As String) As String
            '
            '    Create a temp return info
            '
            Dim ReturnString As New System.Text.StringBuilder
            '
            '    The loop position in the source string
            '
            Dim I As Integer = 0
            '
            '    Sart a new random sequence
            '
            Randomize()
            '
            '    While there is something in the source
            '
            Do While I < SourceString.Length
                '
                '    Get the char to process
                '
                Dim c As Char = SourceString.Chars(I)
                '
                '    Depending on the char
                '
                Select Case c
                    Case "{"c
                        '
                        '    This is an opening so must start a deeper level
                        '
                        ReturnString.Append(Spin(SourceString.Substring(I + 1)))
                        Exit Do
                    Case "}"c
                        '
                        '    This is a closing one.
                        '--------------------------------------------------------
                        '
                        '    calculate the options using the | separator
                        '
                        Dim Options As String() = ReturnString.ToString.Split("|"c)
                        '
                        '    Clear the return string to get an option. 
                        '
                        ReturnString = New System.Text.StringBuilder
                        '
                        '    Get the option
                        '
                        ReturnString.Append(Options(CType(Math.Floor(Rnd() * CType(Options.Length, Single)), Integer)))
                        '
                        '    Get hte rest of the string past the closing bracket
                        '
                        If I < SourceString.Length - 1 Then
                            '
                            '    Disregard all the source before the ending bracket and reset the pointer
                            '
                            SourceString = SourceString.Substring(I + 1)
                            I = -1
                        Else
                            '
                            '    If this is the last char, then nothing more to analyze
                            '
                            SourceString = ""
                        End If
                    Case Else
                        '
                        '    this is a normal char
                        '
                        ReturnString.Append(c)
                End Select
                '
                '    Go for the next char
                '
                I += 1
            Loop
            '
            '    Return the valid string
            '
            Return ReturnString.ToString
    
        End Function

    Then all you have to do is do something like

    Code:
    TextBox2.Text = Spin(TextBox1.Text)
     
    • Thanks Thanks x 5
  13. m3ownz

    m3ownz Regular Member

    Joined:
    Dec 12, 2009
    Messages:
    311
    Likes Received:
    135
    Thanks a thousand times. I know the concept is quite simple, but the example is very very useful.
     
  14. thesaintv12

    thesaintv12 Junior Member

    Joined:
    Mar 9, 2010
    Messages:
    142
    Likes Received:
    23
    I was just about to start a topic on this very subject. Thanks zacatictac.

    Now the next step in my app is to take a page of text and apply the spintax code to it before spinning the output. Anyone done this?
     
    Last edited: Jan 25, 2011
  15. v7web

    v7web Registered Member

    Joined:
    Jul 15, 2010
    Messages:
    51
    Likes Received:
    3
    Many thanks zacatictac, you are a star!
    I have been looking to do this for ages, I dont suppose you could shed some light on the way to choose synonyms and then wrap them in syntax. Or am I being too cheeky!!