4shared-folder.py 778 B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. import requests
  3. import re
  4. import os
  5. link = "https://www.4shared.com/folder/-F9L_kva/004/Sub.html?detailView=false&sortAsc=true&sortsMode=NAME"
  6. headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121201 icecat/17.0.1'}
  7. data = str(requests.get(link).content)
  8. subdirs = re.findall('<a href=".+?" class="jsFolderLink gaClick"',data)
  9. name = 0
  10. for i, subdir in enumerate(subdirs):
  11. if not subdir.startswith("<a href="):
  12. pass
  13. elif "javascript" in subdir.split('"')[1]:
  14. pass
  15. else:
  16. data2 = str(requests.get(subdir.split('"')[1],headers=headers).content)
  17. video = re.findall('href="https://www.4shared.com/video/.+?"',data2)
  18. video = video[0].split('"')[1]
  19. os.system(f"yt-dlp {video}")