Kodi Community Forum
Need help with scraper, removing space - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Scrapers (https://forum.kodi.tv/forumdisplay.php?fid=60)
+--- Thread: Need help with scraper, removing space (/showthread.php?tid=54222)



Need help with scraper, removing space - stacked - 2009-07-08

Code:
            <RegExp input="$$1" output="&lt;url function=&quot;GetTrailer1&quot;&gt;http://www.site.com/?q=\1&lt;/url&gt;" dest="5+">
                <expression>&lt;title&gt;([^&lt;]*)&lt;/title&gt;</expression>
            </RegExp>

This returns the url with the found expression. eg "http://www.site.com/?q=The Movie". But somehow this url returns an error in curl. If the url was "http://www.site.com/?q=The%20Movie", everything would work. How can I replace all the space found from the expression with %20?

btw, would trim help me here?


- spiff - 2009-07-08

Code:
<RegExp input="$$1" output="\1%20\2" dest="5">
  <expression repeat="yes">(.*?) (.*)</expression>
</RegExp>



- stacked - 2009-07-08

I tried that, but it only works on titles with two words. If there are more than two words, the spaces aren't replaced by %20.

btw, is it possible to scan a movie with imdb, then scan it again with another scraper to just add a trailer without replacing any other details?


- spiff - 2009-07-08

no, but you can add the trailer lookup to the imdb scraper.

you need to massage the expression a bit to accept more than one space, it was just to give you the idea.
Code:
<RegExp input="$$1" output="\1%20\2" dest="5">
  <expression repeat="yes">(.*?) ([^ ]*)</expression>
</RegExp>
or thereabout should do it


- stacked - 2009-07-09

thanks. i changed it up a little and got it working.


- AngryFarmer - 2009-10-25

Hey thanks! It helped me a lot !


- UsagiYojimbo - 2010-06-21

Isn't there an encode attribute to the RegExp tag, that should do the trick?


- spiff - 2010-06-21

these days yes. but not back when this topic was alive.


- UsagiYojimbo - 2010-06-27

spiff Wrote:these days yes. but not back when this topic was alive.
BTW, nor the \s construct, neither the trim switch match TAB characters... No


- spiff - 2010-06-27

i added \t to trim a few weeks back.