Ghost.py
Ghost.py copied to clipboard
perform "session.open(url)" In linux Don't complain But it's not the result
from ghost import Ghost
from ghost.ghost import HttpResource
from bs4 import BeautifulSoup
from ghost import Ghost
ghost = Ghost()
with ghost.start() as session:
page, extra_resources = session.open("http://www.haoqu.net/player/mg8/v2.php?id=608807428")
Soup = BeautifulSoup(unicode(session.content), 'html5lib')
print Soup.find(id='myElement').find('a').get("href")
No question in my code on Windows But couldn't run in Linux
Your link was broken so I had to pick another URL from this site.
from __future__ import print_function
import logging
from ghost import Ghost
from bs4 import BeautifulSoup
ghost = Ghost()
logging.basicConfig(level=logging.INFO)
with ghost.start() as session:
page, extra_resources = session.open("http://www.haoqu.net/1/cctv5.html")
Soup = BeautifulSoup(session.content, 'html5lib')
print(Soup.find(id='bdshare').find('a').get("href"))
works just fine. Maybe you could expand your report with a traceback or logs ?