Author Topic: Weather Web Scraper Complete using DOM. With a Twist.  (Read 279 times)

cyberjedi

  • Sr. Member
  • ****
  • Posts: 313
  • The Mighty Hal Machine
    • View Profile
    • Ultra Hal Plugin Shop
Weather Web Scraper Complete using DOM. With a Twist.
« on: May 12, 2017, 07:36:16 am »
Rem Type=Plugin
Rem Name= localnews
Rem Author= cyberjedi
Rem Host=All



Rem PLUGIN: PRE-PROCESS
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.

HalBrain.ReadOnlyMode = True
'Determines that you are talking about the weather
If InStr(1,InputString, "weather",1) > 0 Then
 UltraHal = Getweather(HalCommands)
ElseIf InStr(1,InputString, "weather",1) > 0 Then
 End If

 ' This bad boy is a Scraper with a twist, All the data Scraped is ported through Hals Voice.  It took cyberjedi to pull it off. Enjoy. 
    ' This also Breaks Hals speech limitations on how much he can say. 
 ' Trigger= weather. This is for my news and weather, but has many uses. Just point it where you want. Change key word.
  'Working example https://www.youtube.com/watch?v=ugnohzxD4Hg   
   'I put this together while listening to this. -->>>https://www.youtube.com/watch?v=aqXW57WM9TA
  'Follow me in to the jungle. http://vaughnlive.tv/mrelectric
 ' I give myself about a 6.5 on cool ideas here
' Wana take the time to thank LifeTimeGamer  who took a leap of faith and works with me
' tirelessly and beta test all the code. And watches my dumb movies.


Rem PLUGIN: FUNCTIONS
Function Getweather(HalCommands)

Const SVSFlagsAsync = 1
Const DontShowWindow = 0
Const WaitUntilFinished = 1
Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Sapi = CreateObject("SAPI.SpVoice")
   For Each Voice In Sapi.GetVoices
       i = i + 1
   Next
For loopvar = 0 to i-1
if loopvar = CInt(confirm_voice) then
Set Sapi.Voice = Sapi.GetVoices.Item(loopvar)
end if
Next
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
HalMenu.HalCommand "<SPEAK>" & "Reading headlines !" & "</SPEAK>"
For loopvar = 0 to 2
If tempconfirm = loopvar then
if tempconfirm = 1 then
HalMenu.HalCommand "<SPEAK>" & "Currently reading " & confirm & " latest headlines" & "</SPEAK>"
else if tempconfirm = 1 then
HalMenu.HalCommand "<SPEAK>" & "Okay ." & "</SPEAK>"
wscript.quit
else
HalMenu.HalCommand "<SPEAK>" & "Currently reading " & confirm & " latest headlines " & "</SPEAK>"
end if
end if
xmlDoc.async = false
xmlDoc.load("http://www.tampabay.com/rss/news/?tags=news,weather") ' This is where u put you own rss feed .xml
Set nodelist = xmlDoc.selectNodes("rss/channel/item")
i = 3
For Each item In nodelist
Set f1 = item.selectsinglenode("title")
Set f2 = item.selectsinglenode("description")
HalMenu.HalCommand "<SPEAK>" & f1.text & "</SPEAK>"  ' these two lines are the Magic of the plugin
HalMenu.HalCommand "<SPEAK>" & f2.text & "</SPEAK>"  ' these two lines are the Magic of the plugin
i = i + 1
if i = tempconfirm then
wscript.Quit
end if
Next
end if
Next
End Function
« Last Edit: June 18, 2017, 01:39:17 pm by cyberjedi »

Calhoone

  • Sr. Member
  • ****
  • Posts: 273
    • View Profile
Re: Web Super Scraper Complete using DOM. With a Twist.
« Reply #1 on: May 13, 2017, 02:25:19 am »
Nice work Cyber!! Thanks for all your hard work
 

LiFeTimeGamer

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • LifeTimeGamer
Re: Web Super Scraper Complete using DOM. With a Twist.
« Reply #2 on: May 13, 2017, 09:31:37 am »
For now I just want my HAL to make the morning coffee, you got a Plugin for that cyber????

Hahahaha  Just kidding.... GREAT WORK MAN!!!!!!
If the Code ain't broke your not trying hard enough.

cyberjedi

  • Sr. Member
  • ****
  • Posts: 313
  • The Mighty Hal Machine
    • View Profile
    • Ultra Hal Plugin Shop
Re: Web Super Scraper Complete using DOM. With a Twist.
« Reply #3 on: May 13, 2017, 02:57:39 pm »
LTG : lol

Yes i do, using a Macro and a coffee pot plugged into a Heavy duty X-10 Module.
Only works when the Ibm software is running though

Not worth the hassle, but just a great example of Hal off the Rails


bestwishes
cyberjedi

onthecuttingedge2005

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2230
    • View Profile
Re: Web Super Scraper Complete using DOM. With a Twist.
« Reply #4 on: June 05, 2017, 12:17:18 am »
between X-10 and arduino module kits anything can happen.
I still wanna build my A.I living spaceship or even a living A.I quad-copter. even a digestive type battery to power it, it would seek out insects to feed the power source. for the quad-copter that is.

cyberjedi

  • Sr. Member
  • ****
  • Posts: 313
  • The Mighty Hal Machine
    • View Profile
    • Ultra Hal Plugin Shop
Re: Web Super Scraper Complete using DOM. With a Twist.
« Reply #5 on: June 05, 2017, 11:47:03 am »
Thanx for stopping by:
I've prepped some talking points and and some new code.
Im very serious minded about all this.
But seeing u pop in is awesome



best wishes
cyberjedi
« Last Edit: June 05, 2017, 11:52:16 am by cyberjedi »