mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 00:29:53 -05:00
Merge pull request #177 from CorentinB/fb-ads-variants
Add capture of Facebook ads variants
This commit is contained in:
commit
5bbd262144
@ -22,9 +22,10 @@
|
||||
behavior_js_template: umbraBehavior.js.j2
|
||||
request_idle_timeout_sec: 30
|
||||
default_parameters:
|
||||
interval: 500
|
||||
interval: 1000
|
||||
actions:
|
||||
- selector: 'a[data-testid="snapshot_footer_link"]'
|
||||
- selector: a[data-testid="snapshot_footer_link"]
|
||||
childSelector: i[class="_271o img sp_fqSuadPtkdx sx_6986f4"]
|
||||
closeSelector: 'div._7lq1 > button'
|
||||
-
|
||||
url_regex: '^https?://(?:www\.)?facebook\.com/.*$'
|
||||
|
@ -33,6 +33,7 @@ class UmbraBehavior {
|
||||
// should match older default and simpleclicks behavior, and more
|
||||
var k = this.index;
|
||||
var selector = this.actions[k].selector;
|
||||
var childSelector = this.actions[k].childSelector;
|
||||
var repeatSameElement = this.actions[k].repeatSameElement ? this.actions[k].repeatSameElement : false;
|
||||
var firstMatchOnly = this.actions[k].firstMatchOnly ? this.actions[k].firstMatchOnly : false;
|
||||
var action = this.actions[k].do ? this.actions[k].do : 'click';
|
||||
@ -90,6 +91,17 @@ class UmbraBehavior {
|
||||
var where = this.aboveBelowOrOnScreen(doTargets[i]);
|
||||
if (where == 0) {
|
||||
this.doTarget(doTargets[i], action);
|
||||
if (childSelector) {
|
||||
var childSelectors = documents[j].querySelectorAll(childSelector);
|
||||
while (childSelectors.length > 0) {
|
||||
for (var i = 0; i < childSelectors.length; i++) {
|
||||
if (this.isVisible(childSelectors[i])) {
|
||||
childSelectors[i].click();
|
||||
}
|
||||
}
|
||||
childSelectors = documents[j].querySelectorAll(childSelector);
|
||||
}
|
||||
}
|
||||
didSomething = true;
|
||||
break;
|
||||
} else if (where > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user