Advertisement
Danila_lipatov

pre_downloader_files

Oct 29th, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. import pandas as pd
  2. from bs4 import BeautifulSoup as bs
  3. import xml
  4. import urllib.request
  5. import requests
  6. import ssl
  7. import os
  8. from time import sleep
  9.  
  10.  
  11. ssl._create_default_https_context = ssl._create_unverified_context
  12.  
  13. headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
  14. # header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Sa
  15.  
  16. def donwload(links:list):
  17. for link in links:
  18. url = link
  19. r = requests.get(url, allow_redirects=True)
  20. if r.status_code == 200:
  21. company_ = ''
  22. isExist = os.path.exists(company_)
  23. if not isExist:
  24. # Create a new directory because it does not exist
  25. os.makedirs(company_)
  26. print(f"{company_} directory is created!")
  27. filepath = company_ +
  28.  
  29.  
  30. if __name__ == '__main__':
  31. df = pd.read_excel()
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement