scripts/fetchers/fetch_groupees.py

32 lines
1.2 KiB
Python

#!/bin/python
import requests
import sys
import re
def get_urls(text):
text = text.replace('\n', ' ').replace('\r', '')
#r = re.compile("\"(https:([^<>]*))\">", re.I|re.M)
urls = []
matches = re.findall("\"(https:([^<>]*))\">", text)
if matches:
for m in matches:
urls.append(m[0])
return urls
if __name__ == "__main__":
url = sys.argv[1]
jar = requests.cookies.RequestsCookieJar()
jar.set('_groupees_session', 'OWFWT1ZVTVZtdkFJU2NUUW5ZM2kwblNtTkFYVW0xdUhSWlVpdmROZE9ITWE0UDJIQlV5bmRpcXZLOTF5S1B1Z2lQZ08zUkJpT05FeVRaL0xQcDJJL1hKaVMvOWJPQUVvTTNzVjlaVERXQ2s5RE9WeEc4aWk1ZU9zMGVJd0tscGhLazZvSjVCQWZPMEdFWmVEdXZSYWNld3lTWDlyY1ZYdGdXOG54OXkrOUYyRjB4UXBpVUJJTXloZkN2REhYNTlwZ0s0NlVtbVNBclBRSXZEYVRmZXo1dz09LS0rOEkxVmUvR0ZCUEY1d3Y1RDVXSHd3PT0%3D--fc3a4f506f7c4a283a5d105ae9cb400b604a7fc8', domain='.groupees.com', path="/")
r = requests.get(url, cookies=jar)
urls = get_urls(r.text)
file_urls = [u for u in urls if "https://storage.groupees.com" in u]
cookie = jar.get('_groupees_session')
print("header=\"Cookie:_groupees_session=%s;\"" % cookie)
for file_url in file_urls:
print("remote-header-name")
print("remote-name")
print("url=\"%s\"" % (file_url))