VoxCommando

Help and Support (Using VoxCommando) => RegEx (Regular Expressions) => Topic started by: DimleX on October 29, 2015, 03:45:30 PM

Title: ScrapeUnexpected error
Post by: DimleX on October 29, 2015, 03:45:30 PM
Hello!

Have a problem with Scrape action.

This command working properly with simple URL like google.com, but whan I trying something different such as http://www.imdb.com/?ref_=nv_home - it's working only in Regular Expression Helper, when I manually copy-pasting URL with Ctrl+U, but in command builder line it's just resulting me in
Quote
ScrapeUnexpected error: ScrapeUnexpected error:
System.NullReferenceException: Object reference not set to an instance of an object.
   at eval_᜚.eval_ᜂ(String[] A_0)
   at eval_g.eval_ᜃ(macroElement A_0, List`1 A_1, Int32 A_2)
   at eval_g.eval_ᜂ(macroElement A_0, List`1 A_1, Int32 A_2)

That's what I'm trying to do:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<command id="256" name="RegEx" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Stanton_system&#xD;&#xA;Kallis_system">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://starcitizen.gamepedia.com/Kallis_system</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RegExTool.Open</cmdType>
    <params>
      <param>True</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExSingle</cmdType>
    <params>
      <param>&lt;th&gt;Imports:(.*?)&lt;td&gt;(.*?)&lt;/td&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>{Match.1.2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>
Title: Re: ScrapeUnexpected error
Post by: jitterjames on October 29, 2015, 04:43:27 PM
Do you get that error with the command you posted?

When I test the xml that you posted it seems like it works fine and returns the result: "Research equipment, Luxury goods"

What version of VC are you using?  Please post a log.
Title: Re: ScrapeUnexpected error
Post by: jitterjames on October 29, 2015, 05:00:00 PM
When you get a null reference exception it is usually not normal behavior so the first thing you should try is to close and restart VC.
Title: Re: ScrapeUnexpected error
Post by: DimleX on October 30, 2015, 03:48:17 PM
Yes, when I try my command - I get the error.
Seems like at your PC my command work correctly.
I tried this command on old version of VC, then I downloaded ver. 2.2.0.7 and 2.2.0.9 - the same result, error on Scrape action (restarted VC and PC few times, doesn't helped).

History log:

Code: [Select]
Scrape:http://starcitizen.gamepedia.com/Kallis_system
ScrapeUnexpected error:
System.NullReferenceException: Object reference not set to an instance of an object.
   at eval_᜚.eval_ᜂ(String[] A_0)
   at eval_g.eval_ᜃ(macroElement A_0, List`1 A_1, Int32 A_2)
   at eval_g.eval_ᜂ(macroElement A_0, List`1 A_1, Int32 A_2)
Results.RegExSingle:<th>Imports:(.*?)<td>(.*?)</td>
Error: No matches found
OSD.ShowText:{Match.1.2}
info: OK

It's really strange, that with some URLs it's worked, and with others - don't work
Title: Re: ScrapeUnexpected error
Post by: jitterjames on October 30, 2015, 04:33:15 PM
Yes.  Very strange.  I'm sorry but I have no idea what could cause this error and I have no way to recreate it for testing.  We use scrape for all sorts of things and never have this problem.  Do you have a decent internet connection?
Title: Re: ScrapeUnexpected error
Post by: DimleX on October 30, 2015, 07:11:40 PM
Yes, it's 150 Mbit/s and about 2ms latency. Regular Expression Helper immediately receive the data from URL, but Scrape command doesn't work.
After all thanks for your time!
It's something wrong with my PC, that conflicting with this command
Title: Re: ScrapeUnexpected error
Post by: Kalle on October 30, 2015, 07:23:14 PM
I've tried this command and can confirm what James said - "Research equipment, Luxury goods" is the result. (Win 7 and Win 8.1 - VC2.2.0.9)
Title: Re: ScrapeUnexpected error
Post by: jitterjames on November 09, 2015, 11:57:50 AM
I'm still working on this for you Dimlex.

I will make two changes in the next version.

1 - For the regular scrape action, it will work the same but I am hoping to get a better error message so we can see the reason it fails on your system.

2 - I am adding a new test action Scrape.Simple which uses the exact method as the RegEx tool so hopefully this will work for you anyway.

In the meantime you could also try to use Scrape.Get instead of Scrape but I don't know if it will make any difference.