Advertisement
htym

meteomaps_ru-HTML-meteonava_ru.vbs

Feb 26th, 2020
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Rem погода по сайту meteonova.ru , данные берем по метеостанциям, коды станций берем с сайта meteomaps.ru
  2. On Error Resume Next
  3. C   = ""
  4. URL = "http://meteomaps.ru/meteostation_codes.html"
  5. CAll    R2(URL,"/",3)
  6. f   = C
  7. If Not CreateObject("Scripting.FileSystemObject").FileExists(f) then
  8. Set IE  = CreateObject("InternetExplorer.Application"'используем старый метод для скачивания, антивирус надоел на новое реагировать
  9. IE.Navigate URL
  10. While   IE.Busy Or (IE.ReadyState <> 4)
  11. Wend
  12. C   = IE.Document.body.innerHtml
  13. IE.Quit
  14. Set IE  = Nothing
  15. Call    R2(C,"</table",0)(C,"<table ",1)    'вырезаем таблицу из скаченной страницы
  16. C   = "<table " & C & "</table>"
  17. Call    R1(C,Chr(10),"")(C,Chr(13),"")(C," </tr>"&vbCrLf,"")(C," </tr> <tr>  ","</tr>"&vbCrLf&"<tr>")(C,"tbody>","tbody>"&vbCrLf)(C,"  <td>","<td>")
  18. CreateObject("Scripting.FileSystemObject").CreateTextFile(f,True).Write(C).Close
  19. Call    R2(C,"<tbody>",0)
  20. t   = C&"<tbody>"&vbCrLf
  21. C   = ""
  22. U   = "www.meteonova.ru/weather/"
  23. Set tsLog   = CreateObject("Scripting.FileSystemObject").OpenTextFile(f,1)
  24. Do While    Not tsLog.AtEndOfStream
  25.     LineInFile  = tsLog.ReadLine
  26.     i1  = InStr(1,LineInFile,"<tr><td>",1)
  27.     If  i1 <> 0 Then
  28.         sp  = Split(LineInFile,"<tr><td>")
  29.         spp = Split(sp(1),"</td><td>",2)
  30.         C   = C&"<tr><td><a href='https://"&U&spp(0)&"'>"&spp(0)&"</a></td><td>"&spp(1)&vbCrLf
  31.     End If
  32. Loop
  33. Set ts_log  = Nothing
  34. Call    R1(C,"https://"&U&"Синоптический индекс",URL)
  35. CreateObject("Scripting.FileSystemObject").OpenTextFile(f,2,true).WriteLine(t&C)
  36. End If
  37. CreateObject("WScript.Shell").Run f
  38. MsgBox  "The End."
  39. Function R1(Cc,x,y)
  40.     C   = Replace(Cc,x,y)
  41.     Set R1  = GetRef("R1")
  42. End Function
  43. Function R2(Cc,x,y)
  44.     C   = Split(Cc,x)(y)
  45.     Set R2  = GetRef("R2")
  46. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement