Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WEB RIPPER

Posted on 2003-12-08
10
Medium Priority
?
314 Views
Last Modified: 2010-05-03
I am trying to make a web ripper in VB 6.0...what i need it to do is the following...

http://www.codeshq.com/showthread.php?threadid=6116

first rip that site..l.take all the information off of it...no need for pics...just the text...i dont care if it looks ugly or not...preferably take just the codes...but really it doesnt matter...if you cann make it take just the codes i give extra points...anyways...after that i need it to rip

http://www.codeshq.com/showthread.php?threadid=6117
then
http://www.codeshq.com/showthread.php?threadid=6118
then
http://www.codeshq.com/showthread.php?threadid=6119

and i need it to go all the way to
http://www.codeshq.com/showthread.php?threadid=6843

so basically just keep making the last number go up by one...do u understand...if not post a question...lots of points for this...

thanks in advanced...

Chris
0
Comment
Question by:DIDD0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 

Author Comment

by:DIDD0
ID: 9901598
if possible make a HTML page with the name of the game so people can click the game and see the codes!
0
 
LVL 14

Accepted Solution

by:
aelatik earned 1460 total points
ID: 9902537
Paste the following code in a new project, hit run and see your folder grow with all the info you need. I something needs to be modified just ask...

Const FolderToSave As String = "c:\temp\"

Private Sub Form_Load()
    Dim I As Long
    For I = 6117 To 6843
        FetchPage I
    Next
End Sub

Private Function FetchPage(ID As Long)
    Dim IE As Object: Dim Content As String
    Set IE = CreateObject("internetexplorer.application")
        IE.Visible = False ' True if you wish to see it all happen
        IE.navigate "http://www.codeshq.com/showthread.php?threadid=" & ID
  While IE.busy: DoEvents: Wend
        ' There are two methods to retrieve document info,
        ' innerHTML which only show the displayed text and
        ' outerHTML which show the entire HTML code behind the page.
        Content = IE.document.documentelement.innertext
        ' Content = IE.document.documentelement.outerhtml
        IE.quit
       
        Dim POS1 As Long: Dim POS2 As Long: Dim TITLE As String
        POS1 = InStr(1, Content, "Game Genie codes >", vbTextCompare) + Len("Game Genie codes >") + 1
        POS2 = InStr(POS1, Content, vbCrLf)
        TITLE = Mid(Content, POS1, POS2 - POS1)
        POS1 = InStr(1, Content, "Posts:", vbTextCompare) + 5
        POS1 = InStr(POS1, Content, vbCrLf) + 2
        POS2 = InStr(POS1, Content, "__________________")
        Content = Mid(Content, POS1, POS2 - POS1)
   
        Open FolderToSave & TITLE & ".txt" For Output As #1
            Print #1, Content
        Close #1
        DoEvents
End Function
0
 

Author Comment

by:DIDD0
ID: 9903707
I get an error...

Runtime error

sometimes i get this one:
Content = Mid(Content, POS1, POS2 - POS1)

and most of the time i get an error on this

  While IE.busy: DoEvents: Wend

any help??? thanks
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 14

Expert Comment

by:aelatik
ID: 9903954
How many did it fetch before the error ? Take a look at the last file the view the results
0
 
LVL 14

Expert Comment

by:aelatik
ID: 9904019
This part of the code is ment to extract the codes from the page, try without it :

       Dim POS1 As Long: Dim POS2 As Long: Dim TITLE As String
        POS1 = InStr(1, Content, "Game Genie codes >", vbTextCompare) + Len("Game Genie codes >") + 1
        POS2 = InStr(POS1, Content, vbCrLf)
        TITLE = Mid(Content, POS1, POS2 - POS1)
        POS1 = InStr(1, Content, "Posts:", vbTextCompare) + 5
        POS1 = InStr(POS1, Content, vbCrLf) + 2
        POS2 = InStr(POS1, Content, "__________________")
        Content = Mid(Content, POS1, POS2 - POS1)

If the page does not contain the words "Game Genie codes >" or "Posts:" it could give errors
0
 

Author Comment

by:DIDD0
ID: 9907031
thew main error i get is with the while ie.busy: do events: wend

the error is "automation error"
0
 

Author Comment

by:DIDD0
ID: 9907157
uym like 2 at most...usually just 1
0
 
LVL 14

Expert Comment

by:aelatik
ID: 9907532
When i run this code it goes endlessly end stores every pages code to the harddrive. I don't get it why i doesn't work out for you. Try setting "IE.Visible = False"  to "IE.Visible = True" then you can see what happens. Amd try testing it afer compilation, maybe the errors are raised within the VB IDE.
0
 

Author Comment

by:DIDD0
ID: 9908236
i think it is my internet doesnt load fast enough...o well i will try it at school...although my internet is 3000 megabits/sec so im not sure...anyways my friend could probably do it...il try it in some places and report back to you...thanks man...u get the points...dont worry!
0
 

Author Comment

by:DIDD0
ID: 9908573
ok i made it work
here is my code

Dim I As Long

Private Sub Form_Load()
I = 6116
End Sub

Private Sub Timer1_Timer()
    If I = 6844 Then
        MsgBox "Done", , "Message"
    Else
        I = I + 1
        FetchPage I
    End If
End Sub

Private Function FetchPage(ID As Long)

On Error GoTo ErrHandler

    Dim IE As Object: Dim Content As String
    Set IE = CreateObject("internetexplorer.application")
        IE.Visible = True ' True if you wish to see it all happen
        IE.navigate "http://www.codeshq.com/showthread.php?threadid=" & ID
  While IE.busy: DoEvents: Wend
        ' There are two methods to retrieve document info,
        ' innerHTML which only show the displayed text and
        ' outerHTML which show the entire HTML code behind the page.
        Content = IE.document.documentelement.innertext
        ' Content = IE.document.documentelement.outerhtml
        IE.quit
       
        Dim POS1 As Long: Dim POS2 As Long: Dim TITLE As String
        POS1 = InStr(1, Content, "Game Genie codes >", vbTextCompare) + Len("Game Genie codes >") + 1
        POS2 = InStr(POS1, Content, vbCrLf)
        TITLE = Mid(Content, POS1, POS2 - POS1)
        POS1 = InStr(1, Content, "Posts:", vbTextCompare) + 5
        POS1 = InStr(POS1, Content, vbCrLf) + 2
        POS2 = InStr(POS1, Content, "__________________")
        Content = Mid(Content, POS1, POS2 - POS1)
   
        Open "c:\temp\" & TITLE & ".txt" For Output As #1
            Print #1, Content
        Close #1
        DoEvents
Exit Function

ErrHandler:
End Function
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question