The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Written as part of https://www.scrapehero.com/how-to-scrape-amazon-product-reviews-using-python/ | |
| from lxml import html | |
| import json | |
| import requests | |
| import json,re | |
| from dateutil import parser as dateparser | |
| from time import sleep |
| # The MIT License (MIT) | |
| # Copyright (c) 2016 Vladimir Ignatev | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining | |
| # a copy of this software and associated documentation files (the "Software"), | |
| # to deal in the Software without restriction, including without limitation | |
| # the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| # and/or sell copies of the Software, and to permit persons to whom the Software | |
| # is furnished to do so, subject to the following conditions: | |
| # |
| # /usr/share/doc/lighttpd/fastcgi.txt.gz | |
| # http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi | |
| server.modules += ( "mod_fastcgi" ) |
| def print_table(items, header=None, wrap=True, max_col_width=20, wrap_style="wrap", row_line=False, fix_col_width=False): | |
| ''' Prints a matrix of data as a human readable table. Matrix | |
| should be a list of lists containing any type of values that can | |
| be converted into text strings. | |
| Two different column adjustment methods are supported through | |
| the *wrap_style* argument: | |
| wrap: it will wrap values to fit max_col_width (by extending cell height) | |
| cut: it will strip values to max_col_width |