Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Un-fixed bugs reported on PB forums finder thing
  2. EnableExplicit
  3. InitNetwork()
  4. Dim fmz.s(3,1)
  5. fmz(0,0)="4"
  6. fmz(0,1)="Windows Bugs"
  7. fmz(1,0)="23"
  8. fmz(1,1)="Linux Bugs"
  9. fmz(2,0)="24"
  10. fmz(2,1)="OSX Bugs"
  11. fmz(3,0)="37"
  12. fmz(3,1)="Doc Bugs"
  13. Define look.l=30,i.l=0,ii.l=0,*buffer,html$,posts.l
  14. Declare unsolved(html$)
  15.  
  16. Debug "<html><header></header><body style="+Chr(34)+"background-color:#000;color:#0f0;"+Chr(34)+">"
  17. For i = 0 To ArraySize(fmz())
  18.   Debug "<h1>"+fmz(i,1)+"</h1>"
  19.   *buffer=ReceiveHTTPMemory("http://www.purebasic.fr/english/viewforum.php?f="+fmz(i,0))
  20.   If *buffer
  21.     html$=PeekS(*buffer,MemorySize(*buffer),#PB_UTF8)
  22.     FreeMemory(*buffer)
  23.     unsolved(html$)
  24.     ;get thread count
  25.     For ii=3000 To 0 Step -1
  26.       If CountString(html$,"&amp;start="+Str(ii))>0
  27.         posts=ii+30
  28.         Break
  29.       EndIf
  30.     Next
  31.     ;paginate
  32.     Repeat
  33.       *buffer=ReceiveHTTPMemory("http://www.purebasic.fr/english/viewforum.php?f="+fmz(i,0)+"&start="+Str(look))
  34.       If *buffer
  35.         html$=PeekS(*buffer,MemorySize(*buffer),#PB_UTF8)
  36.         FreeMemory(*buffer)
  37.         unsolved(html$)
  38.       Else
  39.         Break
  40.       EndIf
  41.       look=look+30
  42.       If look>posts : Break : EndIf
  43.       Delay(Random(15000,5000))
  44.     ForEver
  45.     look=30 : posts=0
  46.   EndIf
  47. Next
  48. Debug "</body></html>"
  49. End
  50.  
  51. Procedure unsolved(html$)
  52.   Protected title.s
  53.   Protected url.s
  54.   Protected pos.l
  55.   Repeat
  56.     pos=FindString(html$,"topictitle",pos+1)
  57.     If Not pos : Break : EndIf
  58.     title=Mid(html$,pos+12,FindString(html$,"<",pos+12)-(pos+12))
  59.     url=Mid(html$,FindString(html$,"href="+Chr(34),pos-100)+6,FindString(html$,Chr(34),(FindString(html$,"href="+Chr(34),pos-100)+6))-(FindString(html$,"href="+Chr(34),pos-100)+6))
  60.     url=ReplaceString(url,"&amp;","&")
  61.     url=ReplaceString(url,"./","http://www.purebasic.fr/english/")
  62.     If CountString(url,"&sid=")>0 : url=ReplaceString(url,Mid(url,FindString(url,"&sid="),37),"") : EndIf
  63.     If CountString(title,"Done")=0 And CountString(title,"done")=0
  64.       Debug "<a href="+Chr(34)+url+Chr(34)+">"+title+"</a><br>"
  65.     EndIf
  66.     title="" : url=""
  67.   ForEver
  68. EndProcedure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement