Create MTurk Hit in R with CreateHTMLQuestion

I would like to create a mechanical Turkic Hit using the MTurK package in R. The R code that I use is as follows:

filecontent <- GenerateHTMLQuestion(file="file.html")
print(filecontent)
#filestring <- filecontent [["string"]]
#filestring <- filecontent [["xml.parsed"]]
#filestring <- filecontent [["url.encoded"]]
filecontentForQuestion <- filecontent$string
filecontentForQuestion <- filecontent$xml
filecontentForQuestion <- filecontent$url
print(filecontentForQuestion)
testhit<-CreateHIT(question=filecontentForQuestion,
         title="Title",
         description="Description",
         keywords="Keyword",
         reward="0.05",
         assignments="3",
         duration="3600",
         expiration="20000",
         auto.approval.delay="2590000",
         qual.req=GenerateQualificationRequirement("Approved",">","5"),
     browser = F,
     sandbox=T)

I tried every filecontent file, but always get an error when using this command. Unfortunately, I always get the following error:

Error (AWS.MechanicalTurk.HTML5ParseError): There was an error parsing the
  HTML5 data in your request.  Please make sure the data is 
  well-formed and validates as HTML5

However, the html file I am using is one of the MTurk API manual and looks like this:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/ex
ternalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='ht
tps://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<h1>What up?</h1>
<p><textarea name='comment' cols='80' rows='3'></textarea></p>
<p><input type='submit' id='submitButton' value='Submit' /></p></form>
<script language='Javascript'>turkSetAssignmentID();</script>
</body>
</html>

I get the same error if I use a full empty html5 document with only the required placeholders. Does anyone have an idea why this is not working?

Using the hitlayoutid parameters or the ExternalQuestion command, I would like to explicitly use the GenerateHTMLQuestion command.

+5
source share

All Articles