Skip to content

Forbes articles don't work. #2

Description

@fergyfresh

I was using BeautifulSoup to scrape through a Forbes article to pull out the text until I realized Alchemy has an API to do this. I was running into an annoying scenario where the landing page for any forbes article is the forbes/home page with a 'Continue 3..2..1' displayed on the page. I was able to work around that, but it seems that your API doesn't. Can I feed the raw html from BeautifulSoup to an API call on your end? This would be my quickest workaround. I will be reading the API docs but currently this is what happens.

fromalchemyapiimportAlchemyAPIimportjson# Create the AlchemyAPI Objectalchemyapi=AlchemyAPI()
# Create demo url which will be user input laterdemo_url='http://www.forbes.com/sites/laurashin/2015/09/09/bitcoins-shared-ledger-technology-moneys-new-operating-system/'# Created response object from input urlresponse=alchemyapi.text('url', demo_url)
ifresponse['status'] =='OK':
print('## Response Object ##')
print(json.dumps(response, indent=4))
print('')
print('## Text ##')
print('text: ', response['text'].encode('utf-8'))
print('')
else:
print('Error in text extraction call: ', response['statusInfo'])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions