mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-08-03 03:56:24 -04:00
Merge pull request #144 from galgeek/umbraBehavior18q4
fix instagram captures; add skipIframe feature
This commit is contained in:
commit
d8c9dd2ff4
2 changed files with 16 additions and 7 deletions
|
@ -25,9 +25,11 @@
|
||||||
url_regex: '^https?://(?:www\.)?instagram\.com/.*$'
|
url_regex: '^https?://(?:www\.)?instagram\.com/.*$'
|
||||||
behavior_js_template: umbraBehavior.js.j2
|
behavior_js_template: umbraBehavior.js.j2
|
||||||
default_parameters:
|
default_parameters:
|
||||||
|
interval: 500
|
||||||
|
skip_iframes: true
|
||||||
actions:
|
actions:
|
||||||
- selector: a.coreSpriteDismissLarge
|
- selector: button.coreSpriteDismissLarge
|
||||||
- selector: a>div[role='button']
|
- selector: 'a>.eLAPa>.KL4Bh'
|
||||||
firstMatchOnly: true
|
firstMatchOnly: true
|
||||||
- selector: a.coreSpriteRightPaginationArrow
|
- selector: a.coreSpriteRightPaginationArrow
|
||||||
repeatSameElement: true
|
repeatSameElement: true
|
||||||
|
|
|
@ -26,6 +26,11 @@ class UmbraBehavior {
|
||||||
this.idleSince = null;
|
this.idleSince = null;
|
||||||
this.intervalId = null;
|
this.intervalId = null;
|
||||||
this.intervalTimeMs = {{interval or 300}};
|
this.intervalTimeMs = {{interval or 300}};
|
||||||
|
{% if skip_iframes %}
|
||||||
|
this.skipIframes = true;
|
||||||
|
{% else %}
|
||||||
|
this.skipIframes = false;
|
||||||
|
{% endif %}
|
||||||
this.index = 0;
|
this.index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +46,14 @@ class UmbraBehavior {
|
||||||
var somethingLeftAbove = false;
|
var somethingLeftAbove = false;
|
||||||
var somethingLeftBelow = false;
|
var somethingLeftBelow = false;
|
||||||
|
|
||||||
|
var documents = [];
|
||||||
|
documents[0] = document;
|
||||||
|
if (!(this.skipIframes)) {
|
||||||
var iframes = document.querySelectorAll("iframe");
|
var iframes = document.querySelectorAll("iframe");
|
||||||
var iframesLength = iframes.length;
|
var iframesLength = iframes.length;
|
||||||
var documents = Array(iframesLength + 1);
|
|
||||||
documents[0] = document;
|
|
||||||
for (var i = 0; i < iframesLength; i++) {
|
for (var i = 0; i < iframesLength; i++) {
|
||||||
documents[i+1] = iframes[i].contentWindow.document;
|
documents.push(iframes[i].contentWindow.document);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var documentsLength = documents.length;
|
var documentsLength = documents.length;
|
||||||
for (var j = 0; j < documentsLength; j++) {
|
for (var j = 0; j < documentsLength; j++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue