Search code examples
pythoniframeweb-scrapingghost.py

How can I get data from iframe with ghost.py?


I'm trying to scrape site with iframe so when I do ghost.show() I see my result normally so iframe is filled, but after when I do ghost.content it returns iframe empty, think it's done for security but how can I get this data? Thank you and sorry for bad english.


Solution

  • You can descend into your frame this way:

    ghost = Ghost()
    ghost.frame('<your frame name>')
    
    g.content  # Your frame content
    
    g.frame()  # ascent back to root frame
    

    http://ghost-py.readthedocs.org/en/latest/#ghost.Ghost.frame