Skip to content

Instantly share code, notes, and snippets.

@toaco
Created July 18, 2017 09:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toaco/d88dcaaf70a16d87cc367db302e89a41 to your computer and use it in GitHub Desktop.
Save toaco/d88dcaaf70a16d87cc367db302e89a41 to your computer and use it in GitHub Desktop.
list all resource requested by a request
# 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