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

cyberjedi

  • Sr. Member
  • ****
  • Posts: 345
  • 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: 282
    • 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: 12
    • 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: 345
  • 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: 2244
    • 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: 345
  • 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 »

lightspeed

  • Hero Member
  • *****
  • Posts: 6003
    • View Profile
Re: Weather Web Scraper Complete using DOM. With a Twist.
« Reply #6 on: July 04, 2017, 08:16:44 pm »
I tried using this but can't get it to work as is. i noticed the name is news1 but inside name is local news for the uhp file.
« Last Edit: July 04, 2017, 08:21:12 pm by lightspeed »
 

cyberjedi

  • Sr. Member
  • ****
  • Posts: 345
  • The Mighty Hal Machine
    • View Profile
    • Ultra Hal Plugin Shop
Re: Weather Web Scraper Complete using DOM. With a Twist.
« Reply #7 on: July 04, 2017, 09:41:20 pm »
lightspeed: it works fine man;




not sure what issues ur having with ur machine



cyberjedi

lightspeed

  • Hero Member
  • *****
  • Posts: 6003
    • View Profile
Re: Weather Web Scraper Complete using DOM. With a Twist.
« Reply #8 on: July 06, 2017, 08:51:28 pm »
i am not sure whats going on either , i re downloaded the news1 plug in from the file area and checked it re opened hal and used the trigger word and my hal just talked as it usually does but didn't open the tampa weather ( i left it the same ) , nothing is popping up from my av or malware , but yet the uhp isn't working . i don't get any errors from the plug in it is as if it doesn't work at all. even though its working with other people, i even un checked all other plug ins . . i mentioned before that there inside name says local news but the outside name of the plug in says news1 does that matter, i thought the name had to match?  the plug in , in the past the anger management one worked , i tried it , but i tried it now again it also doesn't work . i think the problem was the ms sapi voice . my ms anna voice works i tested it , but using the trigger word weather , it still didn't tell the weather on the news1 uhp plug in . i tried microsoft mary sapi 5 in the control area and it doesn't work at all (maybe corrupted or something??)