Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from bs4 import BeautifulSoup
- import requests
- def download_scribd_document(document_url, output_path):
- # Initialize Selenium WebDriver
- driver = webdriver.Chrome(executable_path='C:/path/to/chromedriver.exe') # Update this path
- driver.get(document_url)
- # Get page source
- html = driver.page_source
- # Parse HTML with BeautifulSoup
- soup = BeautifulSoup(html, 'html.parser')
- download_link = soup.find('a', {'class': 'download-button'})
- if download_link:
- download_response = requests.get(download_link['href'])
- download_data = download_response.content
- with open(output_path, 'wb') as f:
- f.write(download_data)
- else:
- print("Download link not found")
- driver.quit()
- # Example usage
- document_url = 'https://www.scribd.com/document/your-document-id'
- output_path = 'document.pdf'
- download_scribd_document(document_url, output_path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement