Web Scraper Actor userData dosent work
Im using the Web Scraper Actor, but I'm having some issues with the
userData
.
It seems I cannot change it.
The first time the parameters worked well, now a few weeks later I tried adding another key:value
and there is no change in the run results.
A similar thing happen when I tried another Actor and no userData
was added to the results at all.
I was able to delete one key:value
and add it back, and it did make the change, but not adding a new one.
I have tried to rebuild and even rebuild with clean cash, but no change.
Is there a general bug? or am I missing some stupid thing 😩 ?
8 Replies
metropolitan-bronze•3y ago
You can get userData in page function by context.request.userData and then add it to the return value
return { ...result, ...userData }
xenial-blackOP•3y ago
Thanks
But I'm looking to use the Glob Patterns advance option.
So user data will be according to the URL pattern.
xenial-blackOP•3y ago

xenial-blackOP•3y ago

@yonish3 just advanced to level 1! Thanks for your contributions! 🎉
deep-jade•3y ago
@yonish3 let's continue here not to have two separate discussions about it. I still don't understand exactly what/where's the problem. So the requests are added to the queue but you're missing the userData in pageFunction or what exactly?
xenial-blackOP•3y ago
Sure
In the Web Scraper Actor, under Source -> Input -> Glob Patterns -> Advance -> userData
You can add your userData as a json/object.
1. A few weekes a go i added 2 key:values
{
key_1: val_1,
key_2: val_2
}
This works great
Now, i tried to:
1. add a new key_3: val_3
{
key_1: val_1,
key_2: val_2,
key_3: val_3
}
2. Replace key2:val2 with key3:val3
{
key_1: val_1,
key_3: val_3
}
Both opyiones didnot worked. And i cannot get key_3:val_3 in the resultes.
Is that more clear?
deep-jade•3y ago
Well, not really. We came to the initial replies of both me and Lukas. I already asked you to show us your pageFunciton. What do you mean by
results
? I assume you mean dataset? If that's the case - Lukas already mentioned above that you have to return the userData explicitly as part of the pageFunction return value. I assume you explicitly add key_1 and key_2 to return value, while key_3 is not there, thus you don't see it in your dataset.