2013-07-11, 11:49
Hi,
I'm brand new to scraper development, but i managed to make a "plugin" to the universal media scanner now that gets a json-response with movie plot in swedish, from a IMDB-id. and it seems to work pretty good. but i have some questions...
1. Sometimes the movie plots contains line breaks "\r", i'm not really sure how to remove those from the plot text. (i will add my code below in code block)
2. Is there some kind of best practice how to do if i do changes in metadata.universal so it doesn't get removed if that scraper is updated?
3. Is there any way to set a movies watch-status to watched from the scraper?
4. Is there any way to inside my scraper select a different scraper as fallback? say if my scraper won't find a plot to use IMDbs insted of just leaving it blank?
I'm brand new to scraper development, but i managed to make a "plugin" to the universal media scanner now that gets a json-response with movie plot in swedish, from a IMDB-id. and it seems to work pretty good. but i have some questions...
1. Sometimes the movie plots contains line breaks "\r", i'm not really sure how to remove those from the plot text. (i will add my code below in code block)
2. Is there some kind of best practice how to do if i do changes in metadata.universal so it doesn't get removed if that scraper is updated?
3. Is there any way to set a movies watch-status to watched from the scraper?
4. Is there any way to inside my scraper select a different scraper as fallback? say if my scraper won't find a plot to use IMDbs insted of just leaving it blank?
Code:
<scraperfunctions>
<GetFilmtipsetPlotByIMDbID clearbuffers="no" dest="4">
<RegExp input="$$5" output="<details>\1</details>" dest="4">
<RegExp input="$$1" output="\1" dest="8">
<expression clear="yes" noclean="1">tt([0-9]{6,8})</expression>
</RegExp>
<RegExp input="$$8" output="<url function="ParseFilmtipsetPlot" cache="filmtipset-\1.json">http://nyheter24.se/filmtipset/api/api.cgi?accesskey=APIKEY&action=imdb&returntype=json&nocomments=1&id=\1</url>" dest="5">
<expression />
</RegExp>
<expression noclean="1" />
</RegExp>
</GetFilmtipsetPlotByIMDbID>
<ParseFilmtipsetPlot dest="5">
<RegExp input="$$2" output="<details>\1</details>" dest="5">
<RegExp input="$$1" output="\1" dest="9">
<expression clear="yes" fixchars="0">"description":"(.*?)","</expression>
</RegExp>
<RegExp input="$$9" output="<plot>\1</plot>" dest="2">
<expression>(.+)</expression>
</RegExp>
<expression noclean="1" />
</RegExp>
</ParseFilmtipsetPlot>
</scraperfunctions>