Created
July 18, 2017 09:11
-
-
Save toaco/d88dcaaf70a16d87cc367db302e89a41 to your computer and use it in GitHub Desktop.
list all resource requested by a request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list all resource requested by a request | |
from ghost import Ghost | |
ghost = Ghost() | |
def get_all_resources(url): | |
with ghost.start() as session: | |
page, extra_resources = session.open(url) | |
for extra_resource in extra_resources: | |
yield extra_resource | |
for i in get_all_resources("https://www.baidu.com"): | |
print i.url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment