笨是笨了点
爬是爬下来了
CLEAR
PUBLIC oie
oie = CREATEOBJECT("internetexplorer.application")
lurl="https://
oie.Navigate(lurl)
DO WHILE oie.Busy OR oie.ReadyState!=4
* DOEVENTS
INKEY(2)
?? " 请稍候......",TIME()+0h0D
ENDDO
WAIT WINDOW "延时等待中..." TIMEOUT 1
bError = .F.
TRY
lctext = oie.document.body.innerHTML
CATCH
bError = .T.
MESSAGEBOX("网页打开错误",0+16,"出错了")
ENDTRY
**?page=17">尾页
C1 = '<li class="PagedList-skipToLast">'
C2 = '</a></li></ul>'
页数=STREXTRACT(lcText, C1, C2,1)
?页数
C1 = '?page='
C2 = '">尾页'
页数=VAL((STREXTRACT(页数, C1, C2,1)))
*****标题行*******
C1 = '<th style="width: 20%;">'
C11='<th style="width: 5%;">'
C12='<th style="width: 15%;">'
C2 = "</th>"
a1=''
a1=a1+ALLTRIM(STREXTRACT(lcText, C1, C2,1))+','
a1=a1+ALLTRIM(STREXTRACT(lcText, C11, C2,1))+','
a1=a1+ALLTRIM(STREXTRACT(lcText, C12, C2,1))+','
C1 = '<th>'
C2 = "</th>"
FOR ii=1 TO 6
a1=a1+ALLTRIM(STREXTRACT(lcText, C1, C2,ii))+','
ENDFOR
a1=a1+CHR(13)
*******************内容*****************
FOR aii1=1 TO 页数
oie = CREATEOBJECT("internetexplorer.application")
&&这里为什么不能重复打开??一重复打开就出错
oie.Navigate(lurl)
DO WHILE oie.Busy OR oie.ReadyState!=4
* DOEVENTS
INKEY(2)
?? " 请稍候......",TIME()+0h0D
ENDDO
WAIT WINDOW "延时等待中..." TIMEOUT 2
TRY
lctext = oie.document.body.innerHTML
CATCH
bError = .T.
MESSAGEBOX("网页打开错误",0+16,"出错了")
ENDTRY
C1 = '<td>'
C2 = "</td>"
FOR iii=1 TO
10
a1=a1+ALLTRIM(STREXTRACT(lcText,'<td style="width: 20%;">', C2,iii))+','
a1=a1+ALLTRIM(STREXTRACT(lcText,'<td style="width: 5%;">', C2,iii))+','
a1=a1+CHRTRAN(ALLTRIM(STREXTRACT(lcText,'<td style="width: 15%;">', C2,iii)),CHR(10)+CHR(13),'')+','
FOR ii=1 TO 6
a1=a1+ALLTRIM(STREXTRACT(lcText, C1, C2,ii+(iii-1)*6))+','
ENDFOR
a1=a1+CHR(13)
ENDFOR
c1='<li class="PagedList-skipToNext"><a href="'
c2='" rel="next">下一页'
lurl="https://(STREXTRACT(lcText, C1, C2,1))
?lurl
ENDFOR
?a1
_CLIPTEXT =a1
STRTOFILE(a1,'aaa.csv',0)
[此贴子已经被作者于2021-8-29 10:29编辑过]